In my experience, keeping myself busy with work and always spending free time with my family after work and also on weekends is the most effective way. Because it makes me have no time to gamble and focus more on work and family because it will motivate me to do both well and make me excited to get money, and besides that I will think long and do research before doing it if I use money in the wrong way including gambling.
Actually, in any way if we have a serious intention it will definitely work, do it consistently and keep yourself busy with positive things it can also help reduce or overcome excessive gambling activities.