My truck would lose alot of power when it was warm outside. On cool mornings it was okay but by the afternoon it would really lose power. This guy was having the same issue and he states that changing his camshaft position sensor fixed it. Here is the quote:
"I was living with the shuddering problem for months and finally got fed up with it. The spedo wasn't working and the shuddering, bucking became unbearable. I first started by getting the exhaust bandaged up. No help, but the truck was a *little* quieter (still no cat). I then replaced the coil packs and the problem was less noticeable and I thought for the most part that I had found my solution. I however still had the P0340 engine code. The truck ran well at most speeds, but at lower rpms I would get some hesitation. I lived with that for a day or two, then the truck started acting like its old self. That was it. I finally decided to tackle the camshaft position sensor, which (on a 97 2.3L) is hiding beneath the A/C compressor and power steering pump bracket......
After a long evening digging into parts of my engine compartment that hadn't seen daylight in over a decade, I replaced the sensor and now the truck is running better than I've ever seen. A great feeling."