Erectile problems can happen to men of any age. Many factors can contribute to ED, including poor health, untreated medical problems, medications, and pornography use. Many men struggle to understand when they are experiencing situational sexual dysfunction and when their erectile issue is an ongoing problem that requires medical help.
First of all, it is normal that men will lose their erections about 25% of the time. If you are able to get and maintain an erection 75% of the time or more, chances are your erectile issues are situational, not biological.
That means that the situation you are in may be contributing to your ED, rather than a biological cause. Circumstances such as having too much to drink or being nervous can cause situational ED, whereas having high blood pressure that affects your ability to get or maintain an erection is biological ED.
Another question to consider is whether you are waking up with erections in the morning. If the answer is yes, your ED is probably situational. If you don't wake up with erections anymore, your ED is most likely biologically based, and seeing a urologist or family practice doctor for help would be appropriate.
Something else to consider is porn use. If you are masturbating to very stimulating porn on a regular basis, it might be difficult to get as aroused in the bedroom with your partner. Watching video pornography is very stimulating and men sometimes have difficulty creating the same level of arousal or stimulation with their partners. Consider masturbating without technology, as visual imagery is less stimulating than watching something live. Try this for two weeks and see if your erection quality improves.
Another factor that contributes to ED is not having enough stimulation before beginning or attempting sex. Many men have a sexual script that is kissing for a minute or two and then trying to proceed to intercourse. As men age, they require more stimulation upfront to get and maintain an erection firm enough for sex. Engaging in some foreplay either on you or on your partner is a great way to get your arousal levels up and get an erection firm enough for sex. Many men begin to rush the process of sex once they experience ED. They worry that they will lose their erection, so they move quickly rather than go slow—even though that only makes the problem worse.
You can also consider using a cock ring or penis ring if you are able to get an erection but have trouble maintaining it. Cock rings work by trapping the blood inside your penis so it remains harder for longer.
Another tip is to make sure you communicate what you like during the process of sex. Many men are not communicative about what really turns them on. If you are not aroused by what is going on, you might experience ED. Make sure to share your turn-ons with your partner. Communicating about intimacy should also lead to feeling more connected with your partner, which can help you relax during sex.
Experiencing ED can also be a reason to try sexual experiences other than penetrative sex. Try planning a sex session with your partner that isn't focused on your erection at all. Kissing, licking, sucking, foreplay, and teasing all are super stimulating and don't focus on penetration. Feel free to bring each other to orgasm with these approaches and see if you are able to relax and enjoy the experience. Many men feel like failures when their erections become unreliable. Having a few successful sexual sessions that lead to orgasm without penetration can put the fun back into sex. Many couples find success using this technique and begin to reengage sexually instead of avoiding intimacy for fear of failure.