See a doctor for evaluation of the cause
Review current medications with a clinician
Exercise regularly
Lose excess weight if needed
Stop smoking
Limit alcohol use
Improve sleep
Reduce stress
Treat anxiety or depression
Manage diabetes, high blood pressure, and high cholesterol
Try pelvic floor exercises
Use prescription ED medicines if appropriate
Consider vacuum erection devices
Consider penile injections or urethral treatments
Consider hormone testing and treatment if indicated
Consider counseling or sex therapy
Consider surgical options if other treatments fail
