Perhaps your cat is young? Some cats get a bit rowdy when playing. Also, is she spayed? If she's not spayed, having this done may help.
Try dragging a string around with a little paper tied to the end. Cats really like to chase these things. Your cat may be bored and needs something to do. A laser pointer is also a good toy but the string is better because the cat can actually pounce on it.
If these don't work, consider allowing your already spayed cat to go outside, if she is not afraid. She can lay in the sun, sit by a bush, or simply play. Being outside helps use a cat's brain and it is not so bored. She may be less likely to do these other things if her mind is occupied.
When you pet her, be very gentle and talk to her. Consider if she grabs you, that she may actually be asking for more petting rather than showing aggressive action toward you. Maybe she just doesn't want you to stop.