Few guys realize how intimately an erection is tied to sleep. Lack of sleep is tied to many conditions that can effect erections including heart disease. For example, the last thing that you want are clogged, hardened penile arteries and that is actually what low levels of sleep will do for you. What researchers actually recently discovered is that the arteries of people getting low sleep levels (less than five hours) actually become significantly more calcified.  The rule of thumb is that you get a 33% increased risk of developing calcified arteries for each hour of sleep that you lose. Further verifying this is the fact that those getting the most sleep, greater than 7 hours, had a much lower incidence of calcification.  Further verifying this is the fact that those getting the most sleep, greater than 7 hours, had a much lower incidence of calcification.
And, yes, calcified arteries are just what they sound like: hardened, inflexible arteries that induce heart disease and erectile dysfunction. As we discuss below, sleep and impotence are intimately related: hardened arteries will be BAD for an erection since you want nice, flexible, expandable arteries that allow blood to flow into your penis.
Another big risk factor for erectile dysfunction is inflammation. A 2008 UCLA study found that disturbing just a few hours of participants normal sleep led to significantly increased inflammation levels throughout the body.  One 2009 study showed that a key marker of inflammation (TNF-alpha) was increased by too little sleep as well.  (By the way, some markers of inflammation, specifically C-Reactive protein and IL-6, were increased by too much sleep, so moderation is in order here.)
The primary point though is that lack of sleep can be deadly to your erections due to increased inflammation, which is linked to heart disease, Alzheimers, autoimmune disorders and on and on. Almost every nasty disease known to plague modern industrailized societies is rapidly accelerated by inflammation. No wonder lack of sleep is associated with so many disorders and even some types of cancer! NOTE: If you have trouble falling asleep, then read this link for helpful ideas.
Another way that lack of sleep can lead to erectile dysfunction and impotence is through high blood pressure, or hypertension. Like inflammation, high blood pressure is a known risk factor for erectile dysfunction and scientists have recently discovered the close link between sleep and high blood pressure. One example is insomnia, which is correlated with both heart disease and heart failure, where researchers in a 2009 study found that it raises nighttime blood pressures.  As the lead researcher for this study explained, "Whereas blood pressure decreases in regular sleepers and gives their heart a rest, insomnia provokes higher nighttime blood pressure that can cause long-term cardiovascular risks and damage the heart".
Finally, lack of sleep is also correlated with lower testosterone and testosterone is critical for male libido and the androgen receptors on the pelvic/penile muscles that contract and trap blood in the penis. I cover this extensively in my link on Sleep and Testosterone.
So are their any studies showing that lack of or poor sleep actually leads to a less hard erection and decreased erectile strength? Research has shown that those with apnea have greatly decreased testosterone, libido and erectile function and it's all from inadequate sleep. And don't just get the idea that it's severe sleeping disorders such as apnea that effect erectile function: researchers have found that even "shortened REM latency" and "reduced theta power", i.e. poor sleep quality, are associated with erectile dysfunction as well.  Restless Leg Syndrome, another sleeping disorder, has also been linked with both erectile dysfunction  and heart disease .
When you stop and think about it, it is rather remarkable how many different pathways that reduced sleep can lead to a poor quality erection. Low testosterone, high blood pressure, increased inflammation and arterial calcification - how could get it any uglier? Well, it can if you consider that lack of sleep makes you feel too tired to do much of anything above or under the sheets. And that is bad for your long term health.
13) J Psychiatr Res, Jan 2005, 39(1):93-9
15) Biological Psychiatry, 2008, 64:538-540
19) JAMA, 2008, 300(24):2859-2866
24) Women's Health, Jun 2009, p. 28.25) Sleep, 2009, 32(2):200-204, "Sleep duration and biomarkers of inflammation"
26) Sleep, Jun 1 2009, 32(6):760-766, "Nighttime blood pressure in normotensive subjects with chronic insomnia: implications for cardiovascular risk"
40) Sleep, 2010, 33: 75-79, "Restless legs syndrome and erectile dysfunction"
41) NEUROLOGY, 2008;70:35-42, "Association of restless legs syndrome and cardiovascular disease in the Sleep Heart Health Study"