Before you buy expensive electronic modules, coils, stators, carbs, pumps and such, CHANGE the spark plug. Don't check to see if it is getting spark because many times they can show spark and run fine, only to fail a minute later and then work fine after another few seconds.
2 days ago a guy brought me a John Deere Gator 4X2 to fix. It would start and run great for a minute or two, then die, then start right back up for a minute or two. It would idle forever. AFter checking the fuel delivery system ( it was fine), I replaced the spark plug and it ran fine for my test drive of a few miles. $3 part and $35 labor and he was on his way.Hank