My youngest girls truck was doing something like that a while back and it ended up being a throttle sensorI'll give my boy credit he tried. I think the ground wire has come lose. It will run well then just shut down. Pop the hood and wiggle wires and lights will come back on and crank right back up