How to stop thumb sucking?

my son is 4 months old and has been sucking his thumb a lot lately, to the point there is a little raw spot on his thumb. we try to take it out of his mouth whenever we catch him, but he’ll just go right back to it. i’m wondering if anyone else had to deal with this and what they did to help the sore on his hand