OK, I'm a gecko person who has snakes and not the other way around, but it sounds like he may have been stretching his jaws to help loosen up the skin in that area prior to shedding it, and the side to side might have been to loosen the skin in that area.