Dear Prasad,
Thanks for asking your query at health care magic.
I understand your concern. I am Dr Alok Sinha, MD Psychiatry from India. I will try to help you with best of my effort.
Having proper erection at a time means you do not have any structural or physiological problem. Then then the question is that, why you fail to maintain erection in front of your wife? Answer is
anxiety. Yes, anxiety of performing well in front of wife. Apparently you are having a fear of failure deep engraved in your subconscious mind, although you may/may not accept the same. Let me educate you a little.
Look, erection of penis depends on many factors including mind, nervous system, blood flow etc. first and foremost is the mind. If mind is not ready because of some anxiety/fear/pre-occupation then sexual organ fails to respond. Whenever mind is relaxed it may have psychic stimulation. Due to erotic material or thought certain
nerve cells in brain get activated, these nerve cells send signal to
spinal cord and ultimately reach at penis. Penis has
erectile tissue which acts on getting signal from brain.
You can't penetrate in vagina with a loose penis, whatever lotion you try.
Since you were able to have erection at times, this means there is nothing seriously wrong. You just need to get control of your fear and anxiety. I suggest you to
consult a psychiatrist, who may assess you in detail for any anxiety disorder and prescribe you some anxiolytics and/or
psychotherapy for cure.
Believe me you will be alright. I hope it answers your question. I wish you all the best.