I lose erection in bed with my lover

Dear doctor; I get erections while kissing and caressing but once in bed with my lover, I cannot get an erection for several hours. This is causing me more and more distress and is putting me off relationships and sex. I have no trouble at all when masturbating. Am I impotent? Would using viagra help?
no image
Times Reporter