First time posting would love some advice

So my wife and eye were separated for 2 years both found out we had sex with other people been trying to work past these things. So lately we have been having problems sexually specifically me and my erections. I get rock hard when she touches it and it’s hard for penetration but then I get in my head and it doesn’t stay. I tried ed medication and it doesn’t work. Any advice anyone can give. She is being patient with me as I opened up how much it hurt when we weren’t together but just don’t know what to do.

What gets in to your head mate?

Honestly feeling of insecurities

I think about the partners she has had when we did separate. She did tell me one was bigger than me. One I found about after months of lying it was just one person she had sex with when we were separated.

Feeling if she even sexually attracted to me. Before she would initiate and take turns in when we wanted to start it off. Ever since we came back together I always initiate it.

I guess overall pressure if I’m pleasing her.