M.F.
My daughter would do this and I found that she was most prone to biting when she was overstimulated. This might mean she was in a room with too much noise or too many children, or maybe that she was over-tired. If I noticed that the situation migt lead to biting, I'd give her some time alone in her crib/playpen/bedroom. A 10- or 20-minute break was enough for her to relax. Of course, if it was near nap time, the nap would solve the problem. In fact, long after she dropped her morning nap, we still kept a 30-min morning "break" or rest time simply because she needed that alone time to recharge.
Frustration can also lead to biting simply because kids this age often don't have the communication skills to get their point across. Work with him on simple words to let you know what he wants ("no thank you" or "stop" or whatever) or teach him simple sign language. My son is now trying to bite me when he's not getting his way. If I am holding him, I put him down and say "I will hold you when you are acting nice." If he keeps it up, I march him straight to his room for a little time out, and tell him the same thing again, "You may join us for more play time when you're being nice."
Basically, whether the cause for biting is overstimulation or frustration, the consequence is the same: remove the child from the situation.
Good news is that the biting should stop by the time he's 3.
I would never solve biting with more biting (or even pretend that you will). In fact, if a preschool or daycare worker were to do that, I'd report them.