Although not proven, it is likely that erectile dysfunction can be prevented by good general health, paying particular attention to body weight, exercise, and cigarette smoking. For example, heart disease and diabetes are problems that can cause erectile dysfunction, and both are preventable through lifestyle changes such as sensible eating and regular exercise. Furthermore, early diagnosis and treatment of associated conditions like diabetes, hypertension and high cholesterol may prevent or delay erectile dysfunction, or stop the erectile dysfunction from getting more serious.
The trouble is, most people don't know that sexual dysfunction can be a warning sign of something more serious. Dr Graham Jackson, a cardiologist and the chairman of the Sexual Advice Association, would like to change that. "People aren't aware of the underlying causes of their problems because they feel well otherwise," he says. "They'll say, 'It's my age' or 'I'm nervous because I'm in a new relationship.' But every man with erectile dysfunction should have their heart and blood pressure checked."
I think that a very powerful argument to young men who want to perform at the highest level is to point out the destructive nature of what they’re doing. If they’re having 18 drinks per week, if they’re having three, four, five drinks at any one time, they’re going to guarantee that their erections are not going to be at the highest level. I can’t tell you the number of men who come in saying, they went out, they had a date, they had a big dinner– which, by the way, is also not a great thing for erections, because all the blood is now going to your gut instead of to the genital area. And how important lifestyle changes are to improving your performance, as well, if not better, than the medications. So make certain that you exercise modestly, not excessively. Make certain that you have a smaller meal on an evening or a day that you want to have a sexual encounter, because you want the blood to go, once again, to the penile area and not to your gut. And really, the whole idea of stress– if you’re stressed out, if you’re worried about a lot of things, if you’re distracted, you can’t initiate that psychic stimulus to your spinal cord and then ultimately to your penis. So stress management is incredibly important.
Surgery of the penile venous system, generally involving venous ligation, has been reported to be effective in patients who have been demonstrated to have venous leakage. However, the tests necessary to establish this diagnosis have been incompletely validated; therefore, it is difficult to select patients who will have a predictably good outcome. Moreover, decreased effectiveness of this approach has been reported as longer term followups have been obtained. This has tempered enthusiasm for these procedures, which are probably therefore best done in an investigational setting in medical centers by surgeons experienced in these procedures and their evaluation.
The health care provider will ask about the firmness and duration of erections at different times (e.g., sex with partners, erections after sleep). Discussing sexual dysfunction with a health care provider is very important because many conditions causing it can be successfully treated. If a man has no diseases that cause ED and can have an erection with masturbation or early morning awakening, he likely has ED due to psychological causes.
Endocrine evaluation consisting of a morning serum testosterone is generally indicated. Measurement of serum prolactin may be indicated. A low testosterone level merits repeat measurement together with assessment of luteinizing hormone (LH), follicle-stimulating hormone (FSH), and prolactin levels. Other tests may be helpful in excluding unrecognized systemic disease and include a complete blood count, urinalysis, creatinine, lipid profile, fasting blood sugar, and thyroid function studies.
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. 
The observation that TRT enhances the efficacy of PDE5 inhibitors in hypogonadal men taking these therapies with suboptimal response to the PDE5 inhibitors alone has been reported.33 In addition, investigators have demonstrated that TRT in hypogonadal men can improve erectile function even without the benefit of PDE5 inhibitors.33 In addition, guidelines for managing ED in hypogonadal men by the European Association of Urology recommend controlling the man to a eugonadal state prior to initiation of PDE5 inhibitor therapy.36 Testosterone measurement consists of a serum specimen which should be ideally obtained in the morning because of the normal diurnal variation of testosterone which is at its peak in the morning. Since TRT is relatively safe, and men can potentially see an improvement in erectile function, it seems prudent to consider this issue when presented with a patient suffering from ED.