When I used to have a terrible sweet tooth I devised a plan to stop sabotaging my healthy eating with sweet treats that made me go over the calorie limit.
End of Day Reward was born.
Don't snack between meals on sweets or desserts, biscuits etc during the day, unless it's a healthy breakfast, i.e. porridge with jam/pancakes etc.
Instead, pre-plan 1 treat for the end of the day as a reward for keeping within your calorie range.
This way you eat healthily, keep within your calorie limit and can have your cake and eat it too! I tend to keep a limit of 40kcals to 250kcals per end of day reward treat.