Thought it might be the knock sensor
As has been mentioned, basically it detects detonation and then retards the engine power (timing etc) to try and preserve the engine. If the knock sensor is faulty then you'll be down on power and running richer than normal I expect.
No idea whether that cost for a new one is reasonable or not, 2nd hand will depend on whether there's a breakers yard that has a relevant spare thats ok, but I think you could use a GM replacement if you can find one that will fit as some of the guys in the US use them on the 'Four instead of the stock Toyota part as the GM one is cheaper. Am not 100% convinced though that this is necessarily a 100% safe solution though
Best bet - bite the bullet and buy a new Toyota one. Double check the wiring before you fit it and then when you do DON'T over torque it! The bugga is very sensitive to being overtightened!
Rgds,
Mark