Calmly say "Coach, you are becoming a distraction. I can't listen to you and ref the game at the same time. Which would you prefer I do tonight?" If he's smart, he'll stop...if he keeps going, turn your back to the court while play is going on and repeat the statement...if that doesn't work, walk over and sit down next to him on the bench and say "Now that I'm comfortable, we can have a nice, long conversation".
Editorial Note: Everything after the words "he'll stop" is only wishful thinking and I would never really do it - altho it might be fun the last game I do before retiring!
But the statement has worked well for me for many years...