Ford Focus ZX5, 2005, dies while driving

So the past month or so I’ve noticed that sometimes it takes me one or two tries to get the car started. As in, I will rev the engine but it will take two tries to get it to turn over.

Tonight, while driving, the car died. I was able to get it started again by revving the engine while in park, and probably offending everyone by pulling fast out of a stoplight.

A few minutes later, the car’s RPMs fluctuated while driving…as in, I was going a steady 40mph, but my rpms would shift while at a constant speed. Twice while getting home the car shut off and went into battery mode, as in, the lights and radio stayed on, the dash lights all came on, etc.

The car’s “check engine” light is now on.

I had been thinking that it was a battery thing, what with the starting, but I figure if the lights and radio stay on when it dies, maybe it’s the run circuit on the starter? I’m not sure! I had that problem once with a stick shift, but I don’t know if the symptoms are the same.

I really appreciate any help! Thank you so much!