This is the symptom of a sleep disorder called Narcolepsy. This
sleep disorder is characterized by excessive day time sleepiness,
sleep paralysis, cataplexy where the person has episodes of loss of muscle function while awake, hypnogogic hallucinations and automatic behavior. You will need to consult your primary care physician, who may schedule you for a polysomnogram (sleep test) to rule out sleep disorders and initiate appropriate therapy. Best regards.