That's going to be a hard one to find, because you can't duplicate the
problem. Most sensors will set off the check engine light and store
a code. Your best bet would probably be to take it to the dealer
to run diagnostics. And even then it might not show up.
Probably something simple though.
My brother had a similar problem for a long time, turned out to be
tree leaves in the gas tank, weird huh?.
It would suck them against the tank screen and shut off the car,
while sitting they would loosen and it would run again.
Took a long time to find that one.
Sometimes the simple ones are the hardest.
As soon as your car stops, you could pull a plug wire and crank the engine
to see if it sparks to a ground.
That may tell you if it's electrical or fuel.