If you have ever noticed pups playing, there are times when one will start to tug on the ear of another until it hears a yip. This is a sign to say "That's hard enough" upon which a pup will usually let go. This interaction starts around the 6-8 week period after their birth and is valuable information for them. After all, jaws that are capable of breaking bone should also be able to pick up pups delicately in later life, for example.
Sometimes in the absence of this learning period (i.e. if pups are taken away from their litter too young), this question can be asked of the new human owners. Needless to say (or should that be needles?) a puppy biting can be painful, so it is a good idea to give them the same answer that their siblings would have done.
If your pup starts to nip at your hand, say "Ow!" once. The pup should leave you alone and this is a best practice on how to stop puppies from biting. If not however, then it is wise to stop the interaction before it goes too far. Best to nip it in the bud, as it were. Walk away from the pup or – if the pup chases and continues – you can even give the pup a Time Out on its own in another room, garden or its crate (depending on where you can isolate it). This shows the pup that playing too roughly can lead to being on its own. When brothers and sisters start to play rough, parents will often say "Play nicely or go to your rooms". It’s the same thing.
This "Ow!" tactic is only relevant for when the pup has those needle sharp milk teeth. Once the pup has its adult teeth, nipping and mouthing should not be tolerated at all and a Time Out should be the immediate consequence. Some dogs will mouth and nip for attention (and it usually works!). Better that the dog sees that not only does it not work, but it actually leads to a consequence they really don't like. This way the dog is encouraged to use some self control before things get out of hand.
I once worked with a dog who was a serial mouther. After a few Time Outs, he did it again and actually took himself out to the Time Out room!