On the back of your intake manifold there is a sensor with 2 bolts and a vacuum hose going to it, remove that (should have a screen in it) clean it with carb cleaner and put it back on to see if that helps. Sometimes when that gats clogged it causes problems like you described. It's often overlooked and an easy fix.