Jeep grand Cherokee 1996

I have 1996 grand Cherokee with 190,000 miles on it. A few weeks ago it stopped running while going up hill.It restarted after 15 minutes and ran for 2 minutes and it did that for few times till I decided to get it towed. Then my mechanic looked on it a few times and finally called me that it would run in second gear and he did not know what is exactly wrong with it. It could be driven home in 2nd gear without any issues. I would appreciate any ideas. Thanks!

Auto or Manual?

Auto.

I think the shifter positions may be electrically tied to the PCM.