Hold him with your thumb and index finger at each joint of his head/mouth. Then gently use the middle section of a Q-Tip to pry the mouth open. It wont take much force. Then you just push the Q-Tip back to the where the jaws meet and it will keep the snakes mouth open. then you can use another Q-Tip with either the cotton end or break the cotton end off to remove the piece of substrate. If there is a decent amount, you can also hang the snakes head facing the floor and use a spray bottle with water and gently rinse their mouth out. I had to do with Gina two times as when she was a baby, she got so much Eco Earth packed into her mouth, she literally couldnt close her mouth and them ore she tried to remove it, the more she would get packed in there.
Oh and i forgot to mention, be sure to break one side of the Q-Tip so you can slide it out the side of the mouth when done as you might have an issue trying to pull it outward as snakes teeth curve backwards.