To replace a knock sensor or not?

The faulty knock sensor will not cause the Check Engine light to come on nor will it cause the driveability symptoms you describe. The cost for knock sensor replacement is that high because it involves removing the upper and lower intake manifolds for access. But replacing it will almost certainly not correct your problem. There are many things that may cause the symptoms you describe, but without being able to see the car/duplicate the complaint, any guess is just that–a guess.

Your problem should be easily found if the mechanic is equipped with proper diagnostic equipment and the problem occurs when he is driving your truck with the test equipment hooked up. If the problem only rears its head once or twice a week you may need to leave your truck with the shop for a week or so.