My 93 XJ was doing same sort of thing, it was driving me mad. It would cut out just like yours, it got worse and would take 15 to 20 minutes before it would start again. It turned out to be the CPS, crank position sensor. I had a new one fitted by a garage, as I could not even see it never mind change it! It might be a bad connection or earth, but if after you've cleaned and checked everything it still does it, get a new CPS. It fixed mine.