It sounds like you may have an air leak somewhere in the engine. A lot of erratic revving problems on a 2-stroke engine are signs of lean running, often caused by an air leak. I'd especially check your carb. boot, as it could be torn. A torn carb. boot may have a concealed crack that stays shut most of the time. However, if the engine gets shook up just so while riding, the tear is exposed, air gets sucked in, and the engine leans out and dies.
If you can't find any visible problems, I'd check your flywheel side main seal, and then do a leakdown test on the crankcase. This is a quick way to check for air leaks. Nothing? I'd take the carburetor apart and do a thorough cleaning. Especially check the pilot jet and idle air passages. Also, don't forget that a partially-clogged fuel filter can cause a sudden loss of power...