When a man becomes sexually excited, muscles in their penis relax. This relaxation allows for increased blood flow through the penile arteries. This blood fills two chambers inside the penis called the corpora cavernosa. As the chambers fill with blood, the penis grows rigid. Erection ends when the muscles contract and the accumulated blood can flow out through the penile veins.
Medication — When a medication is the cause of the dysfunction, a change in the medication may help. Men and women with hormone deficiencies may benefit from hormone shots, pills, or creams. For men, drugs, including sildenafil (Viagra®), tadalafil (Cialis®), vardenafil (Levitra®, Staxyn®), and avanafil (Stendra®) may help improve sexual function by increasing blood flow to the penis.
Psychosocial problems are important and may cause erectile dysfunction by themselves or together with other causes of erectile dysfunction, such as diabetes and heart disease. Relationships are complicated and many factors cause tensions, which can affect sexual relations. For some men, these problems can become ongoing and it can help to talk through the issue with a skilled counsellor. It is important to know that the longer erectile dysfunction is left untreated, the greater the effect on relationships. This is another reason why early treatment of erectile dysfunction is important.
I suffered from sporadic limp dick in my 20s. It was usually when I was nervous because I was with a girl I actually liked. A doctor prescribed me Viagra. When I took it, my whole body went bright red, my nose became so congested that I had to breath through my mouth—almost impossible to do while kissing—and I stayed hard for an uncomfortably long nine hours.
Examples of common neurologic conditions that can lead to ED include cerebral vascular accident, multiple sclerosis, Parkinson’s disease, and spinal cord injury. Microvascular disease associated with diabetes is thought to compound the endothelial and neural injuries associated with this disease. Pelvic surgery may disrupt both neural and vascular pathways, resulting in ED.
The association between low testosterone and ED is not entirely clear. Although these 2 processes certainly overlap in some instances, they are distinct entities. Some 2-21% of men have both hypogonadism and ED; however, it is unclear to what degree treating the former will improve erectile function.  About 35-40% of men with low testosterone see an improvement in their erections with testosterone replacement; however, almost 65% of these men see no improvement. 
Clinical experience in switching medications to improve ED has been disappointing in that improvement does not often occur. Nonetheless, it is important to try to discontinue possible offending medications before proceeding to more invasive ED treatment options. Oral ED medications have changed the way clinicians discontinue medications in patients with ED and has improved the approach. For example, a patient may develop ED on a thiazide diuretic. The diuretic may be withdrawn, but a trial of oral ED therapy can be initiated during the observation period while the patient is waiting to see if any spontaneous improvement in ED occurs after drug withdrawal. Alternatively, if diuretic therapy is effective, well tolerated, and controlling blood pressure, oral ED therapy can be used on an ongoing basis to treat the side effect of ED.
Oral therapies via the PDE5i sildenafil, vardenafil, and tadalafil have been proven to be generally safe and effective in select NED populations. The majority of the treatment effectiveness data has been generated in the SCI population. Data regarding the use of PDE5i outside of the SCI population is lacking (58). Furthermore, the ED that exists in the population with neurologic disorders is often multifactorial and may be caused by psychogenic, psychosocial, hormonal, medication-related and disability-related factors. A careful evaluation of each patient must be performed to isolate these factors prior to initiating vasoactive therapy.