96 mazda B4000

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