Boy you changed alot of stuff, hopefully it wasn't from this one issue.
I would do a couple of things first, one would be to pull off the vacuum hose on the EGR valve and plug the hose, then see if problem re-occurs.
Failing EGR modulator/solenoid could be opening EGR valve when it shouldn't be open.
You will get CEL because of EGR valve not working.
Next would be to use a vacuum gauge and hopefully the problem occurs while testing vacuum.
Read here on tests:
http://www.gregsengine.com/using-a-vacuum-gauge.html
An engine is still an engine no matter how many sensors or electronics are added.
Also bang on Cats and mufflers to see if any have loose insides that could be blocking exhaust on and off.
Lastly check fuel pressure, 30-40psi is expected on '97, original fuel pump could be stopping and starting intermittently, long shot since they usually either work fine or die, but not a no shot.
Since 1997 vehicle is OBDII you can get Bluetooth interface that plugs in to any OBDII car or truck and shows Live vehicle data wirelessly while driving, on a Smartphone screen or Laptop with Bluetooth.
When engine starts to stumble you can see what fuel trims are or other sensor data shows to help track down the problem.
Very handy to have and as said works on any vehicle 1995 and up, so not a Ford or Ranger only "tool"
Google: OBDII Bluetooth
Check the APP price before buying the hardware part(plug in), sometimes if you spend a bit more on the hardware the APP is free or cheap, so if you change phones or "rent it" to a friend the cost in minimal.