Many medical conditions may cause disruptions in sleep or an excessive degree of daytime sleepiness.
These are commonly called sleep disorders and are of various types.
Several studies and researches have established that sleep disorders and erectile dysfunction have a mutual relationship that clinicians should be more aware of.
The following are some of the sleep disorders that can be linked to erectile dysfunction:
Sleep deprivation caused by apnea may bring about a dip in the testosterone levels in men. 
It can also restrict the flow of oxygen.
It is quite a well-known fact that both of these are important for healthy erections.
Testosterone is produced mainly during the night, with the levels climbing steadily throughout the night and reaching its peak in the morning.
Studies have shown that not only does a decrease in the hours of sleep lower a man’s testosterone, but REM (rapid eye movement) sleep is also crucial for the production and release of testosterone. 
It is also interesting to note that REM sleep is often less or absent in patients suffering from sleep apnea.
Thus, both the quantity and quality of sleep are essential for testosterone production, without which one can fall prey to ED.
Besides, chronically low oxygen levels at night are harmful to the heart, lungs, brain, as well as the penis.
Scientists have established the fact that a significant cause of ED is often related to insomnia. 
People with insomnia, who cannot fall asleep or stay asleep long enough for rest, have difficulties in dealing with even minor stress.
This naturally leads to anxiety and loss of libido, which in turn can cause erectile dysfunction.
Insomnia anyway makes a person feel fatigued and low on energy which also makes him lose interest in sex.
This type of sleep disorder is characterised by excessive sleepiness, sleep paralysis, hallucinations.
Worse still, it can also cause episodes of cataplexy- the partial/total loss of muscle control, often triggered by a strong emotion such as laughter.
People suffering from narcolepsy tend to feel very sleepy during the daytime and may involuntarily fall asleep during normal activities.
Researchers have observed that several male narcoleptic patients also have erectile dysfunction.
This can be a potentially dangerous situation.
A parasomnia involves unconscious complex, semi-purposeful, and goal-directed behaviours that hold some meaning or importance to the individual.
It includes sleep terrors, sleep-walking, sleep eating, sleep sex, rapid eye movement (REM) behaviour disorder, and much such potential behaviour that occur while the person remains asleep.
Chronic fatigue syndrome
Chronic fatigue syndrome is characterised by unexplained prolonged fatigue that even rest fails to improve. 
On the contrary, it may be worsened by physical or mental activity.
Severe and often disabling, this fatigue can lead to a considerable fall in daily activities, including, of course, sex.
Researchers have found that men with chronic fatigue syndrome are more likely to develop erectile dysfunction as compared to men who do not have it.
The link between the two can be attributed to issues pertaining to the autonomous nervous system.
Since this system is responsible for controlling unconscious functions like breathing and blood pressure, it is also crucial for erections.
If this system is compromised, the ED can be one of the significant consequences.
If you have a suspicion that you may have some sleep disorder, immediately consult a primary care doctor.
Once you discuss your symptoms with him, he can administer a physical exam and help you accurately identify the issues you are facing with sleep.
It will be of great help to him if you maintain a sleep diary for two weeks.
Early diagnosis and treatment are essential since sleep disorders can have a severe effect on your sex life, because of its close relation to erectile dysfunction.
Severe and often incapacitating, this fatigue can lead to a considerable fall in daily activities, including, of course, sex.
It hardly needs to be mentioned that with erratic hormonal levels, prolonged fatigue/loss of energy, interfere with oxygen levels, sleep disorders are bound to take a toll on your sexual activities, which in turn can lead to further frustration and distress.