Baby yanking off breast

Crystal • Married 10/12/14. Have an amazing son, born 11/27/15
My son just turned 5 months old. A couple weeks ago he started doing this thing where he would be nursing, then just yank off the breast! OMG it hurts! I have no warning, I never see it coming. Now my nipples feel bruised and it hurts to nurse. Any one have any idea how to stop this??