I had a similar problem years ago. The signal from the crankshaft position sensor was failing after the motor heated up, as it cooled, it ran fine. I tested the resistance with the sensor off the jeep, put it on my stove, and as the heat increased, the sensor completely failed, resistance fell to zero. New one fixed the problem.
Good luck!