This has happened to me a number of times.
I am now 40. (and yes, it's been very embarrassing sometimes... especially the first time it happened after I was married). I had this problem when I was a child, but always thought I'd grow out of it. My guess has been that it's some sort of emotional issue because it usually happens if I have a dream about going to the bathroom. I have even "realized" I was dreaming, and "caught" myself(woke myself up..)before it got too far. My wife and I always thought I should talk to our doctor, in case it could be a sign of a deeper problem, but you know how that goes.
I would say just have him try to be aware of whether he has dreams about that when it happens, and try to take extra precautions like making sure he has "gone" right before going to bed, and not drinking alcohol, coffee, iced tea, etc., at night. And try NOT to WORRY about it too much. There may be some stressors that are causing it too.
If it gets to be a real concern, SEE YOUR DOCTOR! Your boyfriend won't be the first man around his age to have asked your doc, believe me!
-one last suggestion: when I was a kid, my mom always had me eat a few saltines before I went to bed. Can't remember if it worked any, but maybe it would be worth trying. (PRAY about it too...nobody can help better than Him)