Vinegar! Of course.
Yes it’s that simple, twice a month, more if it’s raining hard, I take a bottle of vinegar out to the back year and sprinkle a good amount around the sandbox. Not the entire bottle, a little less then half usually works, but you have to gag it for yourself.
Works every time.