what atv do you have and does it do anything out of ordinary before it shuts off?
I have a 2001 Suzuki quadrunner and it cuts after i shift sometimes i can get it to all 5 gears and somtimes it will cut off when i go to third it will go for a minute then cut off
check the air filter, the carb vent (it should have a tube running out of the bottom of the carb), and the gas tank vent (the hose coming out of the gas cap).