Looks like early erectile dysfunction
Your symptoms are suggestive of erectile dysfunction. It's common to see such complains in mid age.
Some medical conditions which can lead to these are diabetes, hypertension
, heart or thyroid disorder
. Few medications- beta-blockers, heart medications, or consuming excess of alcohol, nicotine, these can be causative factors.
If your health is fine without any medical conditions then, a few tests may help us to understand the underlying cause - nocturnal penile tumescence
and penile ultrasound with Doppler.
According the test results an appropriate management can be suggested.
Medical management with oral medications is helpful in most cases.
I have also seen people achieving good results with only counselling
and support from partner.
I would recommend a visit to sex therapist.
Hope this answers your questions.