Well I've never had a problem with the cars I've had, saab or bmw. But my parents have had this issue before with their lexus es. There were two different issues. The first one was when my dad was overfilling the gas tank, he does this thing where he likes to make the total be 42.42, or 51.51, etc. (not sure if it's ocd or if he does it for "security" reasons) Well overfilling it past the point of where the gas pump clicks would give him a check engine light, it took a while for him to figure out what was happening because of depending on the total he would only have to add a little bit of gas, or if he overshot it up to $3's too much. After a while the car would go back to normal.
Other times though though it would have a rough idle if he would put local style gas on road trips. I'm sure someone will chime in and say it all comes from the same place, and it probably does. But I like to go to newer style gas stations with a lot of traffic when I can't find a shell. He just puts whatever in it, lowest grade. But the car did not like the bad gas from those places.
The car is a tank though, 2001 es300 170k miles on it, no maintenance whatsoever, except for oil changes, air filter (like twice), brakes and tires. Lol no coolant change, brake fluid, tranny oil etc. It has had zero problems lol... Like zero it has never gone in for service ever. The car drives like a boat though, super floaty and the worst steering feel I've ever felt. Lol the rear suspension rattles but they don't wanna put anything in to it since they are going to trade it in. I'm trying to convince them to get either an X1 or a 328i.
I'm not a mechanic or anything, but I would say start small get some new premium gas from a nice place land dump some techron in. Oh and maybe clean your maf?
The real smarties on here are gonna want some more info, like the mileage of your car, transmission, spark plug history, etc. So it would probably help if you added that.
Hopefully it's something minor I'm sure all the guru's will chime in once they wake up.
Sorry about the rant haha, too tired to proofread it so sorry if I sound crazy