“Erectile problems may show up about three years before a cardiovascular event such as a heart attack or stroke,” says Dr. Ira Sharlip, clinical professor of urology at the University of California, San Francisco.

Image Dr. Andrew McCullough is an associate professor of urology and director of Male Sexual Health and Fertility at the Langone Medical Center at New York University. Credit... Chester Higgins Jr./The New York Times

That’s because plaque will start to clog the small arteries in the penis before the wider coronary arteries. Your doctor will also try to determine whether your E.D. is the result of a psychological issue, in which case he will refer you to a therapist. Depending on your policy, your insurer may cover a set number of visits. (One way for you to check on your own whether your issue may be psychological or physical is try the postage stamp test, also known as nocturnal penile tumescence test.)

By adopting healthier habits, you may be able to improve your overall well-being and restore your erectile function.

“There is increasing evidence that we can reverse erectile dysfunction with lifestyle changes,” says Dr. Drogo K. Montague, director of the Center for Genitourinary Reconstruction in the Glickman Urological and Kidney Institute at Cleveland Clinic.

In a recent study of men with E.D., or at risk for developing it, researchers in Italy found that the men could improve their erections by losing weight, improving their diet and exercising more frequently. After two years of significant lifestyle changes, 58 percent of the men had normal erectile function, according to the study, which was published in The Journal of Sexual Medicine in January.

But lifestyle changes, while basically free, can be difficult to make and may take months to take effect. In the meantime, your doctor will probably prescribe a phosphodiesterase type 5 inhibitor, also called a PDE-5 inhibitor, like Viagra, Cialis or Levitra. These drugs enhance the effects of nitric oxide, a chemical that helps to increase blood flow in the penis. The three drugs work in the same way, but differ in how quickly they take effect and how long they last. If the PDE-5 drugs don’t work for you, don’t give up quickly, says Dr. McCullough, who theorizes that “in over 40 percent of drug failures the problem is with the user, not the drug.” Dr. McCullough adds, “it’s important to take these medications as directed, like on a totally empty stomach, rather than a full one, and not less than 60 minutes before sex.”