Be consistent with your corrections. Every time your horse opens his mouth, you should correct him in the same way. This will help your horse to learn that he is not allowed to open his mouth while riding.
Redirect your horse's attention. If your horse is opening his mouth because he is bored or distracted, try to redirect his attention to something else. This could involve changing your route, asking him to perform a different gait, or giving him a treat.
Make sure your horse's tack fits correctly. If your horse's tack is too loose, it could be slipping into his mouth and causing him to open it. Check your horse's tack before each ride and make sure that it fits snugly but comfortably.
Consider your horse's training level. If your horse is young and inexperienced, he may simply not know that he is not supposed to open his mouth. In this case, you will need to be patient and consistent with your corrections. However, if your horse is an experienced riding horse, he may be opening his mouth as a way to communicate something to you. For example, he may be in pain or discomfort, or he may be trying to tell you that he is scared or anxious. If this is the case, you will need to address the underlying issue before you can stop your horse from opening his mouth.