Final answer:
The sleep-wake cycle is controlled by the suprachiasmatic nucleus (SCN) within the hypothalamus, which acts as the body's internal clock and is involved in circadian rhythms and the release of melatonin.
Step-by-step explanation:
The sleep-wake cycle is ultimately controlled by part of the brain known as the suprachiasmatic nucleus (SCN), which is located within the hypothalamus. The SCN functions as the body's internal clock, managing circadian rhythms by receiving light information through the eyes which regulates the release of melatonin, a hormone that controls sleep-wake patterns. The endocrine function related to sleep is monitored by the pineal gland, which secretes melatonin in response to signals from the SCN. The sleep-wake cycle involves different brain areas, including the thalamus and pons, which play roles in different stages of sleep, such as slow-wave sleep and REM sleep, respectively.