As long as he's not actually acting in a sexually inappropriate way you cover him with a towel or a sheet and ignore it, he can't help his response and is likely as embarrassed about it as you are.
This is a reaction of his body. You ignore it. Old nurses could teach you a flick trick, but I think it has been frowned upon for decades now. His body is simply reacting. You can bet if he is aware he is as embarrassed as you are.