I have TMJ from a hit to the jaw so I know what your feeling. For me, I can sleep on it wrong, have pain which makes me think of the past, which stresses me out, which causes me to clench my jaw causing more pain, right back to the past, more clenching, more pain; you get the picture.
I have a specialized splint for it, but if you don't have insurance that covers it, it is pretty expensive. So, I would suggest you go to someplace like Wal-Mart and pick up a mouth guard (like for football players). There is instructions on how to melt it down to mold to your teeth and wear it at night. I have a day splint as well, but you can wear the football one during the day, it'll just look silly if your out and about. It stops the locking completely. I know there are times when my jaw is so bad, I can't open it.
Stay away from things like gum, beef jerky, hard candies and whatever else that causes a lot of stress on the jaw.