I use to gamble a lot before, but now I gamble casually and I would say I was able to take gambling out of my system.
I felt that my day is incomplete without gambling, but now I don't feel the need or urge to gamble. I think the key is your drive to control your self. Any habit that is not healthy, even difficult must be stopped.
It was similar situation in my case too.
I started gambling long time ago, while i was still in high school. Sports betting was just becoming a thing in my country, and since i watched a lot of sports, this was kinda natural step, to "spice things up" and make it more exciting, and maybe even profit from it. I played little, as since i was student, i couldn't afford big bets. But things quickly got out of control when i started working, and betting more and more. I came to the point that i lost equivalent of yearly salary in matter of few weeks, and one day i simply decided that i will quit. And that was it.
Funny thing, few years after that i started working in a casino and i thought that will be an issue for me and maybe even make me to gamble big again, but luckily everything went ok. I still gamble ( i prefer brick&mortar casinos) but just casually and for fun, nothing serious.