Pinpoint any vacuum leaks with a smoke test, and focus on EGR, PCV, and air intake systems.
Note - When the engine gets caught in a bad lope, turn her off and do a restart!
Is the Incoming Air Temp (IAT) sensor housed in the MAF?
If not, clean the IAT sensor and connector with MAF sensor cleaner.