If fuel pump was defective it happen. See if the fuel pump is putting out good pressure. if corroded connection where the wire that runs from the alternator to the fuse box.
A few things i can think of off the top of my head. Either your electrical board is on the fritz. You've got a bad fuse, or your car is over heating, check the radiator.
First thing to do is check for codes. Then do a check of all components related to the fuel and ignition system since these are likely where the problem will be. Although the ECM itself may have a problem and need to be reprogrammed.