1993 Dodge Ram 2500 stalls & won't start for hours, then runs good for days

Multiple symptoms… some times engine turns over but truck will not start. sometimes engine dies whether driving at slow or high speeds. Happens whether engine is cold or warm.
After sitting a while, the truck starts and will run for several days.
Has 40 lbs of fuel pressure, we’ve changed out the ignition switch, crank sensor, distributor cap, rotor, pickup, engine control module, crank shaft position sensor.
This has been happening for three months, I’ve been towed in 4 times.
When mechanic connects diagnostic tool to the ecm, the engine starts and runs fine. Diagnostic shows no data of previous problem.

My first impression is an intermittent fuel pump problem. This has to be tested when the truck won’t start at all. Have you/they done that? The next guess would be a faulty ignition coil.

I had a '96 Dodge van for 15 years and at about 100k it started acting crazy, almost dying, and sputtering. It turned out that the fuel pump was suppose to move up or down with the fuel level and it was hanging up. Changed the pump and had no more trouble with it.

You need to determine if the this problem is due to a fuel delivery problem or if there is a problem with the ignition system. The easiest way to do that is to spray some starter fluid into the intake when the problem is occurring. If the engine then fires up you need to look at the fuel system, most likely a bad pump or relay possibly. If the engine still doesn’t fire up then the ignition system is suspect. The first thing that needs to be checked is making sure power is getting to the system. There may just be a faulty wire connection in the ignition circuit that is causing the trouble.