The American Sleep Association offers several tips for getting better sleep:

• Maintain a regular sleeping routine by going to bed and getting up at consistent times, including on weekends.
• Avoid naps, because naps can “fragment” the next night’s sleep.
• Avoid watching television in bed, because it causes you to associate your bed with wakeful activities.
• Make sure you’re not consuming too much caffeine.
• Exercise regularly, and try to do so before 2 p.m.
• Keep your bedroom at the cool end of a comfortable temperature, keep it dark, have a comfortable mattress, and if you need to, run a white noise machine or fan to block out other noises.
• Develop a comforting pre-bedtime routine, like a warm bath, quiet time, or meditation.
• Don’t lie in bed awake if you’re having trouble sleeping. Sit in a chair (in the dark, preferably) and let your mind race until you’re sleepy again, and then return to bed. Don’t be tempted to turn on Netflix or surf the web during these times.

A restful pre-bed routine, that may include meditation, can help you shift into sleep mode.

If these tips don’t work, don’t hesitate to speak to your doctor about your sleep problems. You won’t necessarily have to take sleeping pills, and if you are able to resolve your sleep difficulties, your erection health should improve as well.

Lifestyle habits can have a tremendous effect, positive or negative, on the quality of your erections. Your sleep habits, dietary habits, whether you exercise regularly, how you handle everyday stress, and whether you use things like smoking or illicit drugs can all make a difference in whether you develop erectile dysfunction and how easy it is to treat if you do.

Going without sufficient sleep sometimes can’t be avoided, like if you’re the parent of a newborn, but in many cases, we have more control over our sleep schedule than we think. After all, nobody is making us binge watch that television series all in one night. Don’t look at lack of sleep as something to brag about, because its effects, while not necessarily evident after one or two sleepless nights, will eventually come home to roost in the form of too much cortisol, impaired testosterone production, and general irritability, none of which are good for your sex life.

And if you think you may have sleep apnea, by all means seek medical help. Not only can sleep apnea be dangerous, it can be a major contributor to erectile dysfunction, and taking care of the sleep apnea will likewise help address your erection problems.