Could be a dozen things........
Clogged carb.
Bad fuel pump or hard diaphragm.
Bad coil, electrical system that creates spark.
Clogged vent on tank
Leaking exhaust gasket pumping exhaust under cover
Next time it quits, bring a spare plug and pull one wire and ground plug to head and turn over...