How is your vision? Do you wear glasses? What is your age? What other medical conditions do you have? Do your eyes get red? How often do they ache? Is it after you have been reading or working on computer?
It appears to be 2 possibilities. One is that your eyes may dry out while you are sleeping. You can try to use of lubricants before bedtime. Sometimes, I have people use ointments prior to going to bed to protect the eyes during sleep. You can also try to humidify the air and, if possible, turn off any ceiling fans.
The other possibilities is sinus. Due to the fact you are lying down the sinuses may fill up and cause pain and aching. Once upright, the sinuses eventually drain and thus the symptoms are relieved.
Hope this helps and thank you.