If a car engine dies while running, stops and then restarts, the engine is either not getting enough fuel or power. If pushing the accelerator does not prevent the engine from stalling, there is a problem with fuel delivery. If this does prevent the engine from stalling on occasion, there is most likely an electrical or mechanical failure, meaning the fuel delivery in the car is fine.
When an engine stalls, the first things to check are the spark plugs. Have a mechanic test the plugs to see if they are all functional. Next, test to see if the problem is the fuel pump. If a car does not restart for several minutes after stalling, the fuel pump needs to be replaced. On the other hand, if the car restarts immediately after it stalls, this indicates an electrical problem. Electrical problems are harder to diagnose. Check the fuses and have a diagnostic test done.
Other less common causes of a car stalling is a clogged fuel filter and bad catalytic converter. To unclog a fuel filter, purchase a fuel cleaner additive and only put premium gas in the car for a couple of weeks. A catalytic converter can be tested by drilling a hole in the center of it. If air flows through the hole, the part is functioning properly. If there is no air, it needs to be replaced.