Here is a trick I picked up that worked well for me. It sounds silly, but it worked.
Every time I get the urge to eat a sweet, I squirt a shot of lemon juice in my mouth. (I literally carry a small little bottle) I didn't just make this up, it actually has scientific backing.
The reason it helps is first off, it lowers your body's insulin response to a rapid rush of sugar. Insulin spikes have been proven to be a major culprit of weight gain. This is usually the weight gain or lack or weight loss problem for people that feel like they are doing things right.
Also, on a psychological level it makes your brain associated your urge for a sweet with a bitter sour taste. This really makes that urge to taste something sweet diminish over time.
I know it sounds pretty silly, but it really does work. And, it broke my sweets "addiction."