Has he had some trauma that he associates with nighttime or with peeing?
Is it possible he's having what's called a "night terror"? It's a sleep state that's somewhere between sleep and wakefullness. It could be the act of peeing wakes him up, at which time he stops crying and quietly goes back to sleep.
My son does the same thing, but not every night. I believe that my son cries because he has been woken up by the urge to pee and would rather continue to sleep. He also cries and whines the whole time until he is done and heading back to bed.