Nothing ruins spaghetti and clams or a clam boil like biting down on sand. Cleaning is important, but you can remove that sand and every bit of other grit before cooking by "purging" them, or taking advantage of their nature as bivalves and giving them some water to filter. Photo by Vicky Wasik.
You'll need to plan ahead because this process can take some time, and you'll probably need several rounds of purging. Daniel Gritzer, writing at Serious Eats, explains how it works:
Purging is easy: Simply let the clams stand in cold, salty water (about as salty as the sea, which means around a 3% solution, though I always just eyeball it). Lift the clams out every 30 minutes, change the water, and repeat until you see no sand or grit in the bottom of the bowl. That could be after the first purge, or the fourth. It just depends on the clams.
Be careful of any clams that don't close when you prod them because they may be dead. You should also watch out for any clams that don't open when you cook them because they could be empty shells full of mud or sand. You spend extra time prepping the clams by purging them, but the process is so easy and the end result is worthwhile.