There are two reasons we do this: dry eyes and relaxation.
Your tear ducts get tired just like the rest of your body. When this happens, they produce less fluid, which dries out your eyes. If you are really tired, you may drift off mentally, causing you to stare. Having your eyes open for prolonged periods of time increases dryness.
When you rub your eyes you are stimulating the tear ducts, while also spreading moisture over your eye. This pressure has another effect: By pressing against your ocular muscles, you are also putting pressure on your Vagus nerve. This triggers a reduction in blood pressure, which helps you relax and get ready for sleep. This is the same reason we rub our eyes when we're under a lot of stress.
Some people with epilepsy can take advantage of this reaction to stop seizures. Using a device called a Vagus nerve stimulator, they can send an electric pulse, triggering a "reset" of the brain:
Posted 1319 day ago