Hypnagogia

A hypnagogic state is the transitional state of consciousness between wakefulness and sleep.

A hypnopompic state is that which is the transitional state that occurs before you wake up.

During hypnagogia, people see what are referred to as hypnagogic hallucinations.