Welcome to Healthcare Magic
This can be due to Temperomandibular joint
dysfuntion causing the pain behind your ear and a muscle spasm
not allowing you to open your mouth
(Trismus). Visit the Doctor who may give you muscle relaxants and pain killers to help . Avoid sleeping in unnatural positions again. Also get your Teeth examined for any malocclusions which can also cause a similar picture.