I originally thought it was losing electrical power but that isn't the case. It will also occasionally miss while driving, but not die.
Engine dies while driving. Sometimes I can pump the gas to restart. on 2006 Kia Optima
if no engine light on test fuel pressure
1 more answer
cam position sensor connector, check you codes. the connector is front top right, it gets hot from the exhaust manifold, and is brittle. replace the connector with one from a junk yard. pig tail it in.