Treatment depends on the underlying cause. In general, exercise, particularly of the aerobic type, is effective for preventing ED during midlife. Exercise as a treatment is under investigation.:6, 18–19 For tobacco smokers, cessation often results in a significant improvement. Oral pharmacotherapy and vacuum erection devices are first-line treatments,:20, 24 followed by injections of drugs into the penis, as well as penile implants.:25–26 Vascular reconstructive surgeries are beneficial in certain groups.
Vascular damage may result from radiation therapy to the pelvis and prostate in the treatment of prostate cancer.  Both the blood vessels and the nerves to the penis may be affected. Radiation damage to the crura of the penis, which are highly susceptible to radiation damage, can induce ED. Data indicate that 50% of men undergoing radiation therapy lose erectile function within 5 years after completing therapy; fortunately, some respond to one of the PDE5 inhibitors.
A variety of personal habits and lifestyle choices have been linked to ED. In some ways, this is a good thing, since habits can be broken and choices reconsidered. What's more, many of the lifestyle factors that contribute to sexual problems are ones that affect overall health and well-being, both physical and mental. Addressing these factors, therefore, can have benefits beyond improving erectile dysfunction.
Alprostadil injections, which produce an erection in five to 20 minutes that lasts for about an hour. Patients use a fine needle to inject alprostadil (commonly known by the brand names Caverject Impulse and Edex) into the base or side of the penis. Side effects can include bleeding or fibrous tissue formation at the injection site as well as prolonged erection, according to the Mayo Clinic.
A study published in May 2014 in The Journal of Sexual Medicine found that some men can reverse erectile dysfunction with healthy lifestyle changes, such as exercise, weight loss, a varied diet, and good sleep. The Australian researchers also showed that even if erectile dysfunction medication is required, it's likely to be more effective if you implement these healthy lifestyle changes.