I have a just turned 5 year old, very sweet tooth loves snacks, but I am in charge and without me being overly controlling she would never just help herself from the cupboard, maybe I am just lucky?
If I bring treats or sweet things into the house I put them away before DD sees them, if she asks for a cookie or similar I would say you can have two but that's it and put the box back away so no more temptation (eg I would leave them out on a plate - she would scoff the lot!).
If she was still hungry I would say have a piece of fruit and some water (which she loves and would eat all day - I may have to start limiting that as she ends up being very picky/not interested at meal times).
If she took something without asking then I would probably say no more treats for a a day or two and explain why.
I try and keep the treats child size eg 1 or 2 small choc-chip cookies, a small box of smarties (fun size), a handful of crisps instead of a whole packet etc.
My DD will nag and nag for snacks (mainly when she is bored/watching tv) and I have learned most of the time she is not that hungry just bored but it is REALLY hard to stand your ground on this one so I do sympathise.
I let my DD have plenty of treats (within reason) BUT she is very active and a healthy weight, I am not sure I would be so free with handing out chocolate etc if she were chubby and not so sporty. I think you need to try being much more strict with your DD for now and limit chocolate treats to once a week and come up with some healthier alternatives for the other times.
It will be hard but it sounds like she needs you to control this before it gets worse.