At least that is how it is supposed to work.
But oftentimes, things do not work as they should. For some people, the sleep/wake switch remains “on” at night. When this happens, people often have trouble falling asleep. For other people, the “on” switch reactivates too early, and they wake up without adequate sleep. The goal of the doctor is to find the right medication to flip the switch to “off” at bedtime and to keep it off when it is time to sleep.
In past decades, insomnia was usually treated as a short-term problem. However, that has changed. Experts in the field now recognize that insomnia is often a chronic problem. Better drugs have been developed that are safer and do not stay in the body as long as the older alternatives, such as barbiturates. This means that we now have medications that cause less carryover effects (such as daytime drowsiness) and which allow the day/wake switch to turn back on when it is appropriate.