I would advice him to not lose hope and that he can get better, suggest him to go to a psychiatrist to get the treatment for his anxiety.
I would tell him to get professional help to solve the problem. in the mean time if he is in a relationship he should be honest with his partner and they could think of other ways for him to please her and himself until this is taken care of. if he is not in a relationship and he finds one be upfront with person and do what I suggested earlier. I to have the same problem and my wife was very understanding and I think most people would be if your honest either them. of course there is always viagra but that is expensive sometimes. don't lose hope your situation is able to be fixed.