What worked for me was saying "no biting," taking him off and setting him down gently nearby for just a minute or two. If he was still hungry then we'd try again.
I also read that babies can't bite if their mouth is in a sucking position (tongue covers lower teeth) so if they're biting, they're not eating, and probably not all that hungry. I did find that if I tried to keep feeding after a nibbling there'd sometimes be more nibbling -- so maybe he wasn't hungry in those cases.
I also read that you should try to not have a big reaction (hard to do, ouch!) because the baby may like it and try getting the reaction again.
I'm guessing that if your baby has a fit when you take the breast away then hopefully he'll be motivated to have the behavior he needs to keep it! Like I said, I found that just a minute of breast deprivation at that age was enough to make an impression, at least in my son's case, and if he bit again after that then I assumed he was done eating for that session.
Good luck. Usually, like many annoying things, it's just a phase!