Jeep shuts off at 40mph

A few hours after picking up my '95 Cherokee from a tune-up at the dealer the truck just stopped functioning while I was driving it home. Red lights came on. The engine was off. I could barely steer the car to the shoulder. After 10 minutes or so I was able to get the car going again. I drove the car again with no problem the next day. But the same freeze-up happened a week later. I haven’t driven the truck since then. What could it be?