My teeth hurt when I first wake up. What can I do to stop clenching my teeth during sleep?

Multiple options. These include: 1. Muscle relaxers before bed 2. Botox injections 3. Behavior modification therapy 4. Splint therapy with an nti or deprograming appliance. These are the only known devices that reduce clenching by 70%. Other devices protect the teeth and or jaw joint. Each option has its advantages and disadvantages. Consider checking with a dentist with experience and training in tmd.
See a dentist/TMJ Dr. A mouthpiece won't necessarily stop the grinding at night (clenching occurs during the day.) Really should try and address the source of the grinding, if possible. An OTC or online mouthpiece may actually promote more grinding and additional TMJ/TMD issues. A custom mouthpiece is more predictable, adjustable and comfortable.
Clenching teeth. During deep sleep, it is very common for us to clench and grind our teeth. Our teeth are in a locked position while sleeping. The jaw instinctively wants to move but interferences prevent them from moving. We clench and grind to remove these interferences. The best way to help is to be fitted for a professional bite guard. It is a flat surface so the teeth have freedom and take the stress away.