Engine dies while driving. Sometimes I can pump the gas to restart. on 2006 Kia Optima

I originally thought it was losing electrical power but that isn't the case. It will also occasionally miss while driving, but not die.

Asked by for the 2006 Kia Optima
2 answers
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.
if no engine light on test fuel pressure