When you play with your dog, let him mouth on your hands. Continue play until he bites especially hard. When he does, immediately give a high-pitched yelp, as if you're hurt, and let your hand go limp. This should startle your dog and cause him to stop mouthing you, at least momentarily.