It seems like every night as of late has been filled with plenty of tossing and turning, leading to bleary eyes and yawns a plenty the next morning. You’ve tried every trick in the book, but you just can’t seem to fall asleep. Sleeping pills help, but you wake up the next morning sluggish and useless. You’re about ready to throw up your hands and embrace your life as a night owl.

But you’ve begun to notice that your less-than-stellar sleep schedule has been effecting other aspects of your life. You find yourself fighting to stay awake in meetings, you struggle to connect with your partner, and you find yourself growing distant from friends. But worst of all might be your newfound problems in the bedroom. Ever since your sleep issues developed, you’ve struggled to achieve an erection during sex. You’ve never had erectile issues before, so you’re stumped as to why it’s happening now. Can your sleeping habits really affect your erection?

Odd as it may sound, your inability to fall asleep can actually dictate your ability to achieve an erection. While these two issues may seem unconnected, the truth is that a lack of sleep truly can lead to changes within you on a physical level. When you don’t get the sleep your body needs, your body amps up production of a hormone known as cortisol. Cortisol is typically produced in response to stress, but too much of it can actually lead to a dip in your testosterone. When your testosterone levels drop, your libido suffers, which in turn affects your ability to achieve an erection.

So yes, if you’re struggling to get a full nights sleep, it may ultimately take its toll on your erection. Speak to your doctor about your sleep issues and figure out a way around them, and your erection should be just fine.