I used to use a tarp stuck down with tent stakes but, well, you can see what happened. Every time I watered the lawn I got a mosquito breeding puddle that started to grow slime and when the wind blew the tarp wouldn't stay down and blew all over.
Here is my solution:
I used a piece of shade fabric and stapled it to the sandbox on one side with a staple gun. On the other side I sewed a pocket and slid a piece of PVC pipe in it and put end caps on. I bolted some tarp hooks to the side of the box and now all I have to do is slip the pipe under the hooks and it stays. Then I can roll it up out of the way while B. is playing. You have to make sure it's nice and snug so it stays on the hooks.