Blow air at your gerbil. If your pet becomes aggressive (bites or scratches), blow a puff of air at its face. Your gerbil will find this unpleasant, and it should stop biting or scratching.[1]
This same technique works if your gerbil is just nibbling on you.