Hypnagogia is the transitional state from wakefulness to sleep, also defined as the waning state of consciousness during the onset of sleep. Its opposite state is described as hypnopompia – the transitional state from sleep into wakefulness.
Wikipedia