Alright, now I feel like I'm losing a battle! I posted last week about an EGR tube. It's a 2000 Explorer 2wd with 4.0 OHV motor. Tag on the radiator cross states SOHC, but the motor was swapped out at a junk yard.

Truck has 114k on it, unsure of the motor.
Truck had P0402, 0171, 0174, and 0305 codes when I got it in the garage. Had a post cat exhaust leak, a few vacuum leaks, EGR supply tube rotted off, and the EGR intake tube O-ring was shot. Fixed all that, EGR valve works, got rid of all above codes, haven't come back yet. Problem is, idle starts to bog down and surge back up, bouncing from 500-1000 rpm when warmed up in gear, stopped. Almost stalls out when the a/c kicks in in drive, idle kicks up when in neutral and a/c engages. Fires right up when cold, a little hesitant sometimes when warm, not always though. MIL comes and goes with P0300 (which stays in the system), random/multiple misfire. Seems to come on when sitting in gear for a few minutes, MIL light goes off after driving it. Motor runs good when normal driving, a bit of a delay when stepping on it from a low RPM, nothing too bad though.
Here's what I have changed:
Intake plenum gaskets-found loose studs holding down plenum spacer/fuel rail, 3 out of 6 were loose. Also changed all fuel injector o-rings, cleaned fuel injectors (very dirty!). Torqued everything down to spec. There also seemed to be a bit of excess oil in the rear port mostly, slightly in the middle, and hardly any in the front.
AIC motor- made no change.
Crank sensor- no change
PCV valve- old one vented both ways, new one only vents out of crank case. Not sure which is the correct one, just went by the # in the book for OHV motor. No change.
Fixed a few small vac leaks in various lines, booster is good, can't find any other vac leaks now.
I'm starting to wonder if 02 sensors are bad now? The guy that owns the truck said he had codes pulled at auto zone a few months ago, told him both 02 sensors are bad. I'm skeptical, I would think the lean codes were from the EGR sucking fresh air. It used to stall out and surge real bad before I fixed that, at least now it stays running albeit a bit rough.
Wires are good, cleaned ground for coil, I have a new coil pack in the box, but there seems to be a very strong spark coming out for all wires if I pull the boot at the coil one at a time. Vacuum at idle is around 16in, when surging in drive it bounces from 11-14in. When it's happy its around 14, slight surges drop down to 13-12.5. Drops below 10 when A/C engages in gear.
Not sure what else to look for. I will pull the plugs and take a look, he doesn't want to drop a ton of money into it as he probably won't keep the truck for much more than a year or so, but it is due for a sticker soon.
Any help is appreciated.