3 month old BF issues

So this week my baby turned 3 month and his BF is the worst. Keeps latching off and relatching like a lunatic, hurts pretty bad when he does this, my nipples are sore... and he is restless BF like pulling on the nipple swinging his head and body around. Im considering giving up BF... is this a phase thing? He gains weight fine and has dirty dippers I EBF no paci ou bottles...