It must be because you have eye strain or damaged eye muscles.
Most likely, you may be suffering from eye strain. In this case, you don't need to stop doing so. Eye exercise actually help your eyes to relax and feel better, though it may hurt when you doing it. In this case, you should also drip some eye drops to relieve eye strain or have a rest by looking in distance.
What can be worse is that you have something wrong with your eye muscles. Were you punched in the eye lately? Physical trauma is possible to cause eye muscle damage. Nervous disorder can also give rise to this pain. Therefore, if the pain doesn't go away after two days, you need to have your eyes examined by the doctor.