Since it starts, it doesn't sound like an electrical problem, it sounds like it runs out of air. To test this, remove the air filter, start it and see if it stays running. If so, replace the air filter.
It could also be varnish or sludge in the carb bowl. This is best serviced by a technician if you have little mechanical prowess.
After sitting for 3 years, I would at minimum do all of this before I expected it to run ok:
- Change the oil.
- Replace the air filter.
- Drain the fuel tank by removing the fuel line from the engine end (not the tank end).
- Replace the spark plug.
If the above did not work I would drop the carb bowl and clean it, then add one ounce of carb cleaner to a full tank, and let it run (roughly if necessary) through the engine.
After sitting 3 years I would also replace the fuel line itself!