x2 on the crankshaft position sensor. Yours may be starting to go south. Without that critical input from the crank sensor to the computer, you will not have fuel or spark to the engine.
It sounds like your sensor could be "thermally sensitive" meaning that it fails more when exposed to engine heat. If that is the case, testing it in the garage may not be an effective way to troubleshoot it as it could test in acceptable resistance limits when cold. If your problem continues and you don't stumble onto any other cause, you may just want to fork out for one. They're a bit tricky to install, use the SEARCH function for more information on it and some tricks to help in a successful install.
It's possible that it is the ignition coil or some other piece of hardware failing too, but IMHO, the crankshaft position sensor is the most common sensor failure on the Jeep 4.0
Good luck and post back what you find!
99 Cherokee, 4.0 AW4, NP242
Past Jeeps: 49 Willys, 81 Scrambler, 88 Comanche
Without "data", all you have is an opinion!