I have the same problem too. I'm able to attain a good erection but I sometimes lose it just before penetration. I know this is 'just psychological' but it's frustrating as hell. Anxiety can ruin your sex life.
I agree with ttt100: PDE-5 inhibitors (Viagra, Cialis, Levitra) may be helpful but they're not anxiety drugs. Another solution is VIGAMED (phentolamine), an ED drug that inhibits the effects of stress hormones (adrenaline is an erection killer) and promotes blood flow to the penis. I believe the ideal solution would be a centrally acting drug such as Rexahn's ZORAXEL but this new drug is still a couple of years away.
Hi man it's probably just nerves (this is mental thing) and this's normal. Try masturbating less frequent and next time with your wife take some pills (take small dose- viagra, levitra, cialis...) and use it couple times to regain yours self-confidence. You'll see everything will be ok! Don't worry so much and good luck!