Baby pulls nipple when he has gas discomfort

I noticed when he has gas pains, he will be kicking and stretching while pulling his head away from my breast but his gum still holds my nipple tight. It feels like he is stretching and tearing my nipple. Of course I try to hold his head to my breast but this movement comes so abruptly I don't always stop him. How do I stop this? He is 9 weeks old. Will my nipples survive this?