how old is your fiend?
Sex and sexual function/arousal is 90% mental.
When he is asleep his body takes over and produces nice erections also when he masturbates he has no worries and can concentrate on what feels good. but then when he gets with a girl he starts to panic and worry " what will happen?" will my erection be strong?" will i last more than a minute"? "What will they think of me" ext then his erection will go down because he is not "Focused"on having sex.
With that said the premature ejaculation issue is also mental and can be helped with practice. the "Start and Stop" methode usually works very well. it invoulves having sex or masurbating until right before ejaculation and then stoping or slowing down so tht the feeling of ejaculation subsided and then you start up again. repeat as many times as possible (this will take practice) also with this technique his orgasm should feel stronger and he should produce more semen.
I hope this helps, let me know what you think.