I also have a Jeep Cherokee. Had the exact same frustrating problem. Had the exact same towing stories where the car would start right up after bringing it to the mechanic. Replace your crank arm sensor. This fixed it for me. These are NOTORIOUS for going out in this manner where starting becomes hit or miss. Also your distributor shaft sensor may be faulty but try the crank arm sensor first (cheaper and easier to replace).
I had a 1994 Jeep Grand Cherokee that had the exact same problem. Each time it was towed to the dealer it would start right up. Problem began to occur after about 90,000 miles. In four days after four short trips of 5-8 miles it would not start in the parking lots after the 10-15 minutes I was in the stores. Each time I had it towed to the dealer who found nothing wrong. On the fifth tow they determined that the gas tank interior was deteriorating and sloughing off pieces of film that were clogging the intake at the fuel pump. Apparently the tow and the subsequent sloshing of the gas opened the clog and allowed the fuel to flow again. They said they had found this problem in several Jeeps but unfortunately I was out of the warrenty period. Solution was new tank and pump. $600.00 At first I was suspect of the diagnosis but car never had that problem again and I kept it for another 80,000 miles.