Erections depend on good blood flow, so anything that helps your blood vessels tends to help erections. Quitting smoking is one of the most effective single steps, since smoking damages and narrows blood vessels. Regular aerobic exercise improves circulation and has good evidence for improving erectile function, and losing excess weight, especially around the middle, helps both blood flow and testosterone levels.
Reducing heavy alcohol intake, treating sleep problems including sleep apnoea, and managing stress, anxiety, and depression also make a real difference. Controlling blood pressure, blood sugar, and cholesterol protects the vessels that erections rely on.
These changes complement, rather than replace, medical assessment. See a doctor if ED persists, since it can flag underlying conditions and there are effective treatments. Lifestyle improvements often boost both your overall health and your response to any treatment.