Under normal circumstances, when a man is sexually stimulated, his brain sends a message down the spinal cord and into the nerves of the penis. The nerve endings in the penis release chemical messengers, called neurotransmitters, that signal the corpora cavernosa (the two spongy rods of tissue that span the length of the penis) to relax and fill with blood. As they expand, the corpora cavernosa close off other veins that would normally drain blood from the penis. As the penis becomes engorged with blood, it enlarges and stiffens, causing an erection. Problems with blood vessels, nerves, or tissues of the penis can interfere with an erection.
Having erection trouble from time to time isn't necessarily a cause for concern. If erectile dysfunction is an ongoing issue, however, it can cause stress, affect your self-confidence and contribute to relationship problems. Problems getting or keeping an erection can also be a sign of an underlying health condition that needs treatment and a risk factor for heart disease.
On the horizon is gene therapy that would deliver genes that produce products or proteins that may not be functioning properly in the penile tissue of men with ED. Replacement of these proteins may result in improvement in erectile function. Experimental animal models have demonstrated improvement in erectile function with gene therapy. Human studies may also demonstrate success with this therapy. Gene therapy may take a long time for regulatory approval and public acceptance.
Injections are most likely to restore testosterone levels, but this therapy requires periodic injections, usually every two to four weeks, to sustain an effective level. As such, it is less ideal for patients to depend on frequent medical visits for long-duration therapy. Coupled with injection-related pain, hematoma formation, and inconvenience, the serum blood levels of testosterone are also variable. Injection therapy should not be used in men who wish to father children due to the abnormally high levels of testosterone that occur initially after the injection.
Modern drug therapy for ED made a significant advance in 1983, when British physiologist Giles Brindley dropped his trousers and demonstrated to a shocked Urodynamics Society audience his papaverine-induced erection. The drug Brindley injected into his penis was a non-specific vasodilator, an alpha-blocking agent, and the mechanism of action was clearly corporal smooth muscle relaxation. The effect that Brindley discovered established the fundamentals for the later development of specific, safe, and orally effective drug therapies.[better source needed][better source needed]
In a prospective study from the Prostate Cancer Prevention Trial database, Thompson et al reported that men presenting with ED had a significantly higher chance of developing a cardiovascular event over a 7-year follow-up period.  The hazard ratio was 1.45, which is in the range of risk associated with current smoking or a family history of MI.
Prior to the introduction of PDE5i in 1998, intracavernosal vasoactive medications and penile implant surgery were the mainstays of treatment. Penile implant surgery involves placement of inflatable or malleable rods within the corpora cavernosa to provide rigidity for intercourse. Choice of which implant to place usually depends upon manual dexterity and function of the patient, patient anatomy, physician preference and surgical approach.
In some cases, ED can be a warning sign of more serious disease. One study suggests ED is a strong predictor of heart attack, stroke, and death from cardiovascular disease. The researchers say all men diagnosed with ED should be evaluated for cardiovascular disease. This does not mean every man with ED will develop heart disease, or that every man with heart disease has ED, but patients should be aware of the link.
Some men say certain alternative medicines taken by mouth can help them get and maintain an erection. However, not all “natural” medicines or supplements are safe. Combinations of certain prescribed and alternative medicines could cause major health problems. To help ensure coordinated and safe care, discuss your use of alternative medicines, including use of vitamin and mineral supplements, with a health care professional. Also, never order a medicine online without talking with your doctor.
A cold slice of watermelon can do more than just satisfy thirst and hunger during the warm summer months; it can help with bedroom satisfaction. Citrulline, the amino acid found in high concentrations of watermelon, is found to improve blood flow to the penis. A 2011 study revealed men who suffered from mild to moderate ED and took L-citrulline supplementation showed an improvement with their erectile function and were very satisfied. Natural watermelon juice, or “nature’s Viagra,” can also be easier on the stomach, since taking pills like Viagra can cause nausea and diarrhea.
Since endothelial dysfunction, CVD and ED are closely associated in epidemiological studies, the question for clinicians is whether to recommend the man presenting with ED undergo a cardiovascular (CV) evaluation. Clearly, based on numerous studies, ED can be considered at least a ‘marker’ for possible further vascular disease or CVD.15 In their report, Vlachopoulos and coworkers make the point that the man presenting with ED, the clinician, is offered an opportunity to attempt to improve the health of the man by addressing lifestyle modification, and consider further vascular evaluation owing to the clear relationship between endothelial dysfunction, ED and CVD.19
Other hormone levels: Measurement of other hormones beside testosterone (luteinizing hormone [LH], prolactin level, and cortisol level) may provide clues to other underlying causes of testosterone deficiency and erectile problems, such as pituitary disease or adrenal gland abnormalities. Doctors may check thyroid levels in some individuals as both hypothyroidism (low thyroid function) and hyperthyroidism (overactive thyroid function) can contribute to erectile dysfunction.
Treatments include psychotherapy, adopting a healthy lifestyle, oral phosphodiesterase type V (PDE5) inhibitors (Viagra, Levitra, Cialis, Stendra, and Staxyn), intraurethral prostaglandin E1 (MUSE), intracavernosal injections (prostaglandin E1 [Caverject, Edex], Bimix and Trimix), vacuum devices, penile prosthesis and vascular surgery, and (in some cases) changes in medications when appropriate.
Both ED and low testosterone (hypogonadism) increase with age. The incidence of the latter is 40% in men aged 45 years and older.  Testosterone is known to be important in mood, cognition, vitality, bone health, and muscle and fat composition. It also plays a key role in sexual dysfunction (eg, low libido, poor erection quality, ejaculatory or orgasmic dysfunction, reduced spontaneous erections, or reduced sexual activity). 
For best results, men with ED take these pills about an hour or two before having sex. The drugs require normal nerve function to the penis. PDE5 inhibitors improve on normal erectile responses helping blood flow into the penis. Use these drugs as directed. About 7 out of 10 men do well and have better erections. Response rates are lower for Diabetics and cancer patients.