The reason humans can hold their urine in much better when we sleep is because when our bodies are lying down the pressure on our bladder is reduced.
The other reason is when we're sleeping the sensitivity of our bladder is reduced.
This inhibits the reflex that empties our bladder.