it could also be a dirty EGR system. The valve might have alot of carbon on it and therefore is moving sluggish or maybe is not making a very good seal when it closes. Alother possibility is that the EGR ports in the intake manifold are pretty well choked with deposits.
The EGR is supposed to be closed at idle or anytime the throttle is closed but if it is leaking exhasut gasses into the intake air stream it will cause the engine to run as if it had a rich fuel air mixture and the oxygen sensor readings will agree with that. Therefore, the computer will control the injectors to inject less fuel to bring the fuel mixture to "acceptable" levels. At idle the airflow through the engine is so little that even a very small leak of exhaust gasses into the intake stream will casue an enrichening effect so stong that after you lean the fuel mixture so it is equalized with the ammount of available oxygen the mixture will be so lean it may not be able to burn and the engine will slow down or try to stall. The computer will then open the IAC valve to let in more air, inject a little more fuel and suddenly the air/fuel mixture equalizes and the engine revs quickly, faster than the IAC valve can react to maintain an idle of around 700 to 750rpm.
Either the EGR or the IAC vavles can cause a similar problem. Both of the vavles have corresponding ports built into the intake manifold and both of these ports, especially the EGR, can become dirty or even partially blocked and lead to problems like you're describing.
I'd like to suggest that you start out with a complete upper intake manifild cleaning and decarbonization. If you're doing it yourself you'll want to pick up some gaskets first, throttle body, IAC valve, EGR valve and upper intake manifold to lower intake manifold gaskets before you start this though. There is a complete how-to write up in the how to section of the site
here and here