Start of by pulling the codes, you can turn the ignition key on
and of fast 3 times with out cranking it leaving it on on and
the codes should appear on the dash where the odo is. You
can go to this site to see what the codes mean:
http://www.wjjeeps.com/faultcodes.htm
It could be that your PCM is failing but start of by cleaning
the connectors to the PCM. Also if your battery is going bad
this can happen so have the battery load tested and check if
the alternator is giving out over 14 volts like it should and
clean the connectors on the battery and clean the ground
where it connects to the truck.