Yup, classic case of TMJ.  Try sleeping with a nightguard, you can buy one at any pharmacy.  You may want to see your dentist.  I had it bad where it would slip, lock, then I'd have to make a concerted effort to crack it open again.  Ended up having orthoscopic surgery and it made a huge difference, no more cracking/locking, but I still sleep with a nightguard.  This is the one I use... got it at Walgreens.
