The switch identified in a study in fruit flies works by regulating the activity of a handful of sleep-promoting nerve cells, or neurons, in the brain.
The neurons fire when we are tired and need sleep, and dampen down when we are fully rested.
"When you're tired, these neurons in the brain shout loud and they send you to sleep," said Professor Gero Miesenbock of Oxford University, in whose laboratory the new research was performed.
Although the research was carried out in fruit flies, or Drosophila, the scientists said the sleep mechanism is likely to be relevant to humans.
"There is a similar group of neurons in a region of the human brain. These neurons are also electrically active during sleep and, like the flies' cells, are the targets of general anaesthetics that put us to sleep. It's therefore likely that a molecular mechanism similar to the one we have discovered in flies also operates in humans," Dr Jeffrey Donlea, one of the lead authors of the study, said.
The researchers said that pinpointing the sleep switch might help us identify new targets for novel drugs - potentially to improve treatments for sleep disorders.
"The big question now is to figure out what internal signal the sleep switch responds to," said Dr Diogo Pimentel of Oxford University, the other lead author of the study.
"What do these sleep-promoting cells monitor while we are awake If we knew what happens in the brain during waking that requires sleep to reset, we might get closer to solving the mystery of why all animals need to sleep," Pimentel said.
The body uses two mechanisms to regulate sleep. One is the body clock, which attunes humans and animals to the 24 hour cycle of day and night. The other mechanism is the sleep 'homeostat': a device in the brain that keeps track of your waking hours and puts you to sleep when you need to reset.
This mechanism represents an internal nodding off point that is separate from external factors. When it is turned off or out of use, sleep deficits build up, researchers said.
"What makes us go to sleep at night is probably a combination of the two mechanisms. The body clock says it's the right time, and the sleep switch has built up pressure during a long waking day," said Miesenbock.
The work in fruit flies allowed the critical part of the sleep switch to be discovered.
"We discovered mutant flies that couldn't catch up on their lost sleep after they had been kept awake all night," said Donlea.
The findings are reported in the journal Neuron.