Hi E.,
Hurting someone else to comfort one's self is not OK, even if you are a child. I would stop the co-sleeping to begin with. Nurse, hold and comfort your baby as usual, except when he try’s to pinch you, stop him. Hold is hands away and say "no" or "ouch"..."you hurt mommy".
Start putting him in his own crib. Feed, nurse and give him a comforting bath before bedtime. He will cry for a while----it might seem like a long time, but he will probably sleep before you know it, (especially if he is full, dry and tired). Check with your pediatrician on how long it's OK to let him cry. It will always seem longer then it really is, and it's very hard not to pick a crying baby. A stuffed animal, favorite blanket, toy, musical mobile etc., in his crib may give some comfort and distraction.
I am not in favor of co-sleeping for a number of reasons. It’s O.K. to take your kids into the big bed to cuddle, play a little in the morning, comfort when they are sick or scared; but I believe it is better for a child and mom and dad, when they have their own bed/space. I hope some of these things will work for you.