How can you stop your eye from twitching?

Eye twitching. If this is a pulling or quivering sensation in one or several eyelids then it is likely mykyomia which tends to be intermittent and resolve after months. If it is bilateral or forceful it may be hemifacial spasm or bilateral blepharospasm and these may be benign but require evaluation. Lastly especially in a child it could be a tic or habit spasm.
Stimulants. For occasional twitching try reducing caffeine intake and other stimulants. Also make sure you are seeing clearly and not squinting as this may cause twitching. If things progress see an ophthalomologist as it may be blepharospasm.