It's called a dislocated jaw. A lot of people have a clicking noise in their jaw when they open and close their mouths it is hard to fix without surgery. I believe it is TMJ Google this and see if the symptoms are similar. You probably feel the pain because you are grinding your teeth at night and as such put pressure on your teeth. Get a mouth guard.