1999 Mazda B2500 Idel Issue

I have a 99’ Mazda B2500 5 speed manual transition that will idle high some times while Im driving, that is in motion coating or in gear. It idles high enough it will cause the truck to speed up or maintain speed when i let off the gas in gear, and when i put it in neutral it will either stay at the rpm it was running at or it will speed up to 2500 - 3000 rpms until i slow to almost a complete stop, then it magically goes away. It will only stop the high idle when i come to a complete stop, even though it will go away just before the truck comes to a stop, if i touch the gas or put it in gear for a California roll it will kick back up to 2500rpm and keep it up. It does not do this all the time. some times i go months with out it happening. Some times it goes away in a few minuets and some time it will do it all day on a 18 hour ride. It is totally up to change whether or not its going to act up. Iv had it like this for year and cannot find a pattern to it at all. The amount of gas it gets at high idle speed is not much and is only noticeable on the highway when I go to coast or change gears, in town I notice it every time i come to a stop. Any info will help. Thanks for your time.

The problem might be with a dirty/defective Idle Air Control valve.

http://www.rockauto.com/catalog/moreinfo.php?pk=1005919&cc=1356195

If the IAC valve fails to close it can allow too much air into the engine. The O2 sensor detects this extra air and the computer adds fuel accordingly to compensate for this extra air.

The IAC valve can be removed and cleaned with throttle body cleaner to see if that fixes the problem. If not, the IAC valve may require replacement.

Tester

It’s your Throttle Position Sensor (TPS). Cleaning/changing the IAC may fix it for a short time, but it will most likely come back. I had this problem for 2 years and no one had any ideas, then I found that tip online. Replaced it myself for about $35.00 and it has been fine for about 6 months now. (Tip: the screws to remove the TPS from the throttle body are a bear to remove. I’d replace them with bolts if possible, in case you have to do it again)