Welcome to Healthcare Magic
Have you been tested for Diabetes
. Is there any burning micturition. You need to get tested if you haven't. There are various methods to treat but first you need to rule out the above problems and psychological issues as well. While being with your partner, the moment you feel loss of erection, you may ask her to masturbate your penis till you get erection again then you can resume sexual intersourse with her. If this doesn't work you may report to Urologist
. There are medicines like Sildenafil
available, pumps, surgeries also which can be discussed with your Urologist which one to best suit you.