Sleeping, as widely known, is the exercise which makes the brain and body relax, this exercise may be taking your productive time (time in which you can work) but is very important for the body and the brain to relax and heal itself. There are certain parameters which need to be there for the body to have the ability to enjoy sleep and heal, they are more to deal with prevailing energies within than outside, as it is these energies when in order, makes the life easy.
Our brain, registers darkness and takes up the measures to relax its system, and then moves forward by releasing melatonin hormone, which is acknowledged by thalamus and hippocampus parts of the brain and sleep is induced (which is natural biological response of the body), but at times when the energies of heart chakra and sacral chakra are not in order or are blocked or dysfunctional, then the brain acknowledges darkness ( night) through its sensory input fed by the eyes, but is unable respond to it, hence the system fails to release Melatonin hormone, which results in sleeping disorders and when left unattended/uncured, it manifests into insomnia which further leads to various serious issues, like affecting heart, intestines and liver.
Vedas, by Chakra meditation, have illustrated most erudite way to cure the energies right from their source and hence resolving the problem. The problem in inability to sleep or excessive sleep is when the brain is unable to regulate this functioning of the body, which is when to sleep. Sacral chakra and heart chakra, play prudent roles in defining how the brain would acknowledge and respond to the inputs it is getting from the eyes ( as it is the eyes which tell the brain about night). It is not the functional problem of the eyes, body or the brain, but the energies which are driving and controlling the functions are the ones who are not performing naturally, the way that they are supposed to.