Stalling/power loss while driving?

Just want to ask a quick question. The other day while out driving I was passing a slower car and everything seemed fine. Good kickdown response and power. Then the car has a small backfire and I lose all power. I coast into a turn lane and stop. Car fires right back up. Drive a couple of miles and it dies again, but with no backfire this time. Again it starts right up after I stop. This has happened a few times now but not everytime I drive. So I guess my question is what might be the cause of this? I know I have not given all the info and specs needed but was hoping for a idea on where to start looking as the cause of this. Coud it be a bad ballast resistor?

Thanks for any responses.