This depends on whether the vehicle is gas or diesel fuel. A gasoline powered vehicle can have this fault if the fuel pump is failing. This causes the engine to "cut out" at high RPMs, when more fuel is required. It can also fail if the ignition coil is failing. When the coil is failing it tends to overheat during prolonged driving and cause the engine to stall. Diesel vehicles can either be caused by a failing fuel pump, water in the fuel filter that needs to be drained or a break in the wire powering the injector pump solenoid. If you happen to own a Nissan Serena with a SD20 engine, watch this spot. Mine has just started to exhibit those symptoms and I will be sure to update this answer as soon as the dealer has finished checking mine.
Died while driving? Alternator
Overheating ? - Check radiator for water and coolant, and engine for enough oil and not old burnt oil
if it won't start up again chances are it's probably your fuel pump
there is humidity in your engine control module
check your timing belt
engine rubber mounts or timin out
it may be the o2 scensor
when i am driving my toyato 2001 Eaco stops running, it will start back up
Why engine stalls on 1993 Chrysler Intrepid while driving and sometimes at stops?
Stalling while driving may be caused by a collapsing or kinked neoprene fuel line.
Check timing belt
The year, make, model and engine info would help.