If you can keep an erection when you’re alone, then you’re probably worried about something when you’re with your partner. Think about how you feel and then talk to your partner about your concerns. You might be putting too much pressure on yourself or not protecting yourself by using condoms and birth control. Or maybe you’ll discover that you’re really not ready for sex right now and need to wait until it feels right.
Phosphodiesterase inhibitors: This class of medications includes sildenafil, tadalafil, and vardenafil. They work by inhibiting an enzyme called phosphodiesterase type 5 (PDE-5), allowing more blood to enter the penis and helping to produce an erection. These medications are often taken before sex and will cause an erection only when the man is sexually stimulated.
The medications are extremely effective, which is very good. And the medications are, for the most part, extremely well-tolerated. But there are, like with any medications, a potential downside. The one absolute downside to the use of any of these erection what we call PDE5 medications is if a patient is using a nitroglycerin medication. And nitroglycerins are used for heart disease and for angina, for the most part, although there are some recreational uses of nitrites. And that’s important because your blood vessels will dilate and your blood pressure will drop. And that is an absolute contraindication.
Both ED and low testosterone (hypogonadism) increase with age. The incidence of the latter is 40% in men aged 45 years and older.  Testosterone is known to be important in mood, cognition, vitality, bone health, and muscle and fat composition. It also plays a key role in sexual dysfunction (eg, low libido, poor erection quality, ejaculatory or orgasmic dysfunction, reduced spontaneous erections, or reduced sexual activity). 
Endocrine problems, though uncommon, should be considered in patients presenting with impotence. As a rule, impotence due to hypogonadism will be partial and accompanied by decreased libido. Hypothalmic–pituitary problems, which include tumors, are the most common endocrine disorders causing impotence, followed by primary gonadal failure from one of many causes. Poorly controlled diabetes with polyuria and polydypsia is an important reversible cause of impotence, as is hyperthyroidism. Certain drugs, alcohol included, can lead to impotence as a result of endocrine disturbances.
I'm a college guy who has only had sex a handful of times, and I've noticed a bit of a reccurring issue. During any foreplay and all that good stuff, I have a nice big erection, but as soon as I'm about to stick it in, the erection disappears like a frightened turtle. Then once the 30 seconds of embarrassing made-up explanations concludes, the erection is back.
With sex therapy, your counselor looks at the sexual problems you and your partner are having. Sex therapy works with problems such as performance anxiety, which means that you worry so much about whether you will be able to have sex that you are not able to. It also helps when you have erection problems that are not due to physical or drug problems, or premature ejaculation (you come too quickly). It may help you to reach orgasm or to learn to relax enough to avoid pain during sex. Counseling can help you to adjust to the treatment you and your doctor choose.
Alteration of NO levels is the focus of several approaches to the treatment of ED. Inhibitors of phosphodiesterase, which primarily hydrolyze cGMP type 5, provided the basis for the development of the PDE5 inhibitors. Chen et al administered oral L-arginine and reported subjective improvement in 50 men with ED.  These supplements are readily available commercially. Reported adverse effects include nausea, diarrhea, headache, flushing, numbness, and hypotension.
While we may think the penis has a mind of it’s own, it’s actually heavily dependent to the brain, and too much stress can interfere with a man’s ability to obtain and hold an erection. According to Healthline, stress can interrupt how your brain sends messages to the penis to allow extra blood flow. Even though a man may want to have sex, too much stress can make this impossible.
…have traditionally been classified as impotence (inability of a man to achieve or maintain penile erection) and frigidity (inability of a woman to achieve arousal or orgasm during sexual intercourse). Because these terms—impotence and frigidity—have developed pejorative and misleading connotations, they are no longer used as scientific classifications, having been…
However, men are affected psychologically when it comes to achieving erections. For instance, if a man is with a woman for the first time, or even before he feels comfortable with her, he may suffer from performance anxiety. In such a situation, his mind and body are both saying yes, but then they become out of sync. The body is then saying yes, but the mind is filled with question. “Will I be able to perform?” “How long will I last?” “Am I big enough to satisfy her?” “Is she looking at that mole on my stomach?” All kinds of questions may be going through a man’s mind upon getting in bed, and these can be distracting, they can lead to self-doubt, and therefore, failure to achieve or maintain an erection.
ED usually has something physical behind it, particularly in older men. But psychological factors can be a factor in many cases of ED. Experts say stress, depression, poor self-esteem, and performance anxiety can short-circuit the process that leads to an erection. These factors can also make the problem worse in men whose ED stems from something physical.