Fuel pump as a guess. Would check to see that all connections are good and that it is getting consistent electric.
Check the wiring harness and make sure there are no loose connections or worn wires.
It could be a failing sensor. I had a similar issue and replacing the fuel pressure sensor fixed it.
Make sure the engine isn't overheating. Sometimes an overheating engine can shut off to prevent damage.