you should get this program called "flux" google it. I take it that you're doing this at night time. What that program does is it'll dim the "blue" in the RGB lighting on your monitor because that is what's causing your eyes to get sore since it's a powerful light to your eyes.
Othewise you can get "Gunnars" glasses which is a yellowish tinted glasses that some gamers use.
If I stare at a screen or anything else that's bright for too long, my eyes start to hurt. I have a light sensitivity and I have to be careful. In your case, you might be straining your eyes by staring at the screen for too long. Resting them is the best thing you can do.