The first thing you absolutely must do is remove your battery terminals, clean them really well, and reinstall them, TIGHTLY! These WJ's suffer from flakey battery connections, even tho they seem to start ok. Try it, it might fix a miriad of problems that you are having. If that doesn't fix the stalling issues, you may have a bad PCM.
I was just about to post that exact thing...
If you are experiencing electrical "gremlins" like your dash lights are flickering, and your Jeep doesn’t start, but magically will a moment later....
SECURE YOUR BATTERY CABLES!
Here is how to MAKE SURE it’s on there good:
Remove Negative cable. Remove Positive cable.
Take positive cable, loosen the nut all the way out and with a large flat blade screwdriver, carefully pry the ends of the "clamp" apart to open it up wide. Next, seat the "clamp" back onto the battery post, twisting back and forth as you push down. Hold the "clamp" down onto the BASE of the post while tightening it to the post.
Repeat for negative cable.
The reason for all this is due to the batteries posts being conical and is wider at the base. This will ensure a solid connection, everytime!