What sensor is it?

96 mazda b4000(ford ranger basically) my problem is my truck is beginning to idle at only 100 or so and it shuts off. I replaced spark plugs, bored out the honey comb out of the Cat, oxygen sensor is still good. and my check engine light is on 0040 (exhaust gas too hot) or something of that sort. the code just poppet up today, but its been doing this drain of power and low idle for about 2 weeks now. if i leave the truck alone for a few hours its good to go. but the if i drive it longer than a few minutes…everytime i go to hit the accelerator, nothing happens, in fact if i leave the accelerator alone, it keeps a stable RPM. but the second i hit it, it sounds as if its spitting or choking. Mind you my fuel pump still has ample pressure, its been checked already. what must it be? please tell me its a sensor

Take a deep breath and keep the posts about a problem down to one only.
This is going to be hard to figure based on gutting the cat because that makes one wonder what else has been gutted or altered.

Any kind of history about this truck that should be known to us? Any valve train issues, mileage on the truck, when if ever was the fuel filter last changed, etc.
And codes need to be read and presented as given. “Something like that” is a pretty hazy one.

The air-flow sensor, located just downstream of the air filter box, sends a signal (a voltage reading) to the ECM telling it how much air is entering the engine. The ECM computes how much fuel is needed and opens the fuel injectors for a given length of time. The injectors spray the correct amount of fuel for the amount of air measured. To operate properly, the injectors must be fed constant pressure. The computer receives a signal from the throttle position sensor to help it compute the proper amount of fuel, along with other sensors…

If your truck will not respond to the throttle at all, the chain of command described above has been broken…

Assuming the engine is mechanically sound (how many miles??) A diagnostic program run on a laptop plugged into the OBD-2 port will give real-time read-outs of all the sensors and timing functions taking place in the engine…