The instant it dies toss some fuel down the carb and crank the engine.
If it fires up then you have a fuel problem
Pull the spark plug & check for a spark.
No spark = electrical problem.
Most common problems that give your symptom is a blocked vent in the cap or air line.
And debris plugging the outlet from the tank.