My boyfriend and I want to have sex and we have tried to a few times. He has an erection up until right before we are about to have intercourse. He is 18 and has had sex before but it has been a while. We have talked about it and we are completely comfortable together so I'm not sure why he would be nervous. We want to try again but I don't want him to keep getting upset and feeling bad about not being able to "perform".
His erectile problems are most likely related to anxiety so it means you need to back off from the expectation of intercourse and be sexually intimate in other ways that are more comfortable for him. It is exactly that pressure of needing to "perform" that will cause a loss of erection so give this some time, concentrate on mutual pleasuring rather than intercourse, and it should resolve. If not, he can talk with a physician about his concerns.