One thing that worked for me with my dog is just ignoring it.
When we were playing and she went and started biting my hand, I said NO, firmly, and then got up and walked away and ignored her for a while. Then I would play with her later and if she did the same thing again, I just did the same thing. Said no, and walked away. She got the message and hasn't done it since.
Another thing that a friend of mine did is when his dog (a Shihtzu) is said "OW" really loudly and then walked away. He caught on right away that he was hurting him and didn't do it again.