Electrical or fuel problem?

Sounds like it may be vapor lock. Next time it happens if the engine doesn't start, pull the air cleaner and wack open the throttle. If you get a nice steady stream of gas from the accelerator pump, it's not a fuel problem.