Alertness is regulated by a group of nuclei (bodies of nerve cells) spread throughout the brain stem and the medulla called the reticular formation.
These nuclei are a relay system that connects the lower parts of the nervous system to the cerebral cortex and integrates signals and information in the brain.