
It is not completely clear whether drinking coffee affects a man’s erections, as studies have had mixed results.

In 2015, a study of over 3,700 men suggested that those who consumed 170-375 mg of caffeine each day (the equivalent of 2 to 3 cups of coffee) were at lower risk for erectile dysfunction (ED). The researchers hypothesized that caffeine relaxed smooth muscle tissue and arteries in the penis, resulting in better blood flow and firmer erections.
However, the researchers also noted that they hadn’t accounted for other ED risk factors, like heart disease. More research was needed to verify their findings, they said.

In 2018, a larger study of over 21,000 men between the ages of 40 and 70 found that drinking regular coffee didn’t appear to affect erections. However, men who drank decaffeinated coffee were more likely to have ED, especially if they were smokers.
Still, the authors said their results should be interpreted with caution. In this study, the heaviest decaffeinated coffee drinkers also tended to be smokers or have other health conditions like high blood pressure and high cholesterol levels.

Men who have questions about their sexual health should see their healthcare provider. Both physical and psychological factors can contribute to erection problems, and a complete physical exam can help pinpoint the cause.
Resources
American Journal of Epidemiology via Medscape
Lopez, David S., et al.
“Coffee Intake and Incidence of Erectile Dysfunction”
(Full-text. May 2018)
https://www.medscape.com/viewpublication/2406
International Society for Sexual Medicine
“Caffeine May Reduce Risk of Erectile Dysfunction”
https://www.issm.info/news/sex-health-headlines/caffeine-may-reduce-risk-of-erectile-dysfunction/
“Can increasing caffeine intake help with erectile dysfunction (ED)?”
https://www.issm.info/sexual-health-qa/can-increasing-caffeine-intake-help-with-erectile-dysfunction-ed/