I would first, check your battery connections, make sure they are not corroded. Then check your alternator, I would go through an alternator a year with my Mustang after I had a sound system installed. Sometimes, Advanced Auto can do a free scan check on your car. If nothing comes up, stop buying cheap gas if that's what you're doing. I have never had an issue with base gas, Mobil, Sunoco ect. But places like "Jim Bob's Gas" can be bottle of the barrel with who knows what mixed in.
*I do not know if there really is a Jim Bob's gas, I was just trying to say a random no name place.
From my experience with cars, I'm willing to bet that it's electrical or as Jersey said, an alternator. Take your car to a mechanic to get a professional opinion.
This happened to my car too. After asking around, googling, etc we finally took it to a mechanic.$100 later, it was still shutting off.
To make a long story short, buy fuel injection cleaner from any auto store. Read the directions on the back and your car should be fine. Please try this before taking it to a mechanic and wasting your money.
If its just turning off it might be as simple as a sensor, mine would just randomly turn off even while driving, I took if to get serviced where they replaced it & never had a problem like that again, it had nothing to do with gas at all...bottom line is nobody can tell you what's wrong but a pro