My eyes hurt because I have Sjogren's syndrome. In my case symptoms worsen when I am agitated. Before I knew I have Sjogren's I thought I was having severe allergies. Depends what kind of pain you have, is it the litteral pain you feel in your eyes or even behind your eyes? Or is it more like the feeling of having sand in your eyes?
I'm not suggesting you have anything like that but if it happens often and it really bothers you, go visit oftalmologist. It may be something trivial and it could be easily treated.
_________________
Someone wrote in their signature English is not their first language. Same here.