Stop breastfeeding

My boys almost 2, I’ve bought him his own bed that’s placed at the side of mine he’s still breast feeding in the night. I was just wondering how to stop this as if he cries to much he ends up making himself sick (which I don’t want)

Thanks for any advice