Urine is made by the kidneys and stored in a sac made of muscle, called the urinary bladder. A tube called the urethra leads from the bladder through the prostate and penis to the outside of the body. Around this tube is a ring of muscles called the urinary sphincter. As the bladder fills with urine, nerve signals tell the sphincter to stay squeezed shut while the bladder stays relaxed. The nerves and muscles work together to prevent urine from leaking out of the body.
When you have to urinate, the nerve signals tell the muscles in the walls of the bladder to squeeze. This forces urine out of the bladder and into the urethra. At the same time the bladder squeezes, the urethra relaxes. This allows urine to pass through the urethra and out of the body.