All here are good suggestions, but I suspect it simply has dirt in the carb, which eventually sucks up into the tiny jets and then it quits running right.
Does it keep running if you choke it when it is warm? If so you are sucking fuel passed the jets that normally control and that surely means plugged jet, or dirt particles in the sed. bowl.
If it is a plugged gas cap, simply loosing the cap will clear that problem.
If it is a solenoid that went bad, check the fuel line when the motor stalls to see if the fuel flows freely to the carb...if so, it isn't the solenoid.
If it is the ignition module, by pass it with a simply solid state generic module which you can get thru Northern, or JCWhite cat. They cost about $12.
Also check the oil...if there is gas in the oil, you can smell it.
Also make sure that the air filter is not plugged cuz that can do what you describe too.
Do each of the above one at a time and isolate the issue...going from simplest to most expensive/time consuming.
That's what the mechanics do, and charge you $90/hr.