|MadSci Network: Zoology|
This sounds like a fun assignment! Let me see if I can dig up some useful information for you.
If your imaginary critter is crablike, then I assume it's a crustacean, or at least some kind of terrestrial arthropod. You already know that crabs respire through gills, which work in water but not in air. However, your creature lives in sand dunes, so it'll need some kind of respiratory structure that does work on land.
The land crab you mentioned, the red crab (Gecarcoidea natalis) belongs to the family Gecarcinidae, all of which are terrestrial as adults. These animals still use gills for gas exchange. However, the chamber that encloses the gills (the branchial chamber) has become highly vascularized and acts as a lung. In other words, the gills hang in the branchial chamber as in "normal" crabs, but respiratory gas exchange occurs across the surface of the chamber itself as well as over the gills.
Most of the terrestrial crabs live either in burrows or in shells (hermit crabs). The burrows protect the animals from predation, temperature extremes, and desiccation. Air-breathing animals can lose a lot of precious water via evaporation over their respiratory surfaces, so lungs and branchial chambers are usually enclosed structures with only a small opening to the outside. Living in a burrow gives a land crab additional protection against desiccation -- the air inside the burrow will be more humid than the air outside, and less subject to drying winds. The burrow also provides an air-filled pocket in the ground (or sand dune, in the case of your imaginary animal) so the crab can breathe.
Your imaginary crablike animal could respire and live in a burrow as the gecarcinids do. It would most likely need to return to the sea to reproduce, though. Even the terrestrial red crab has a more or less coastal distribution, because females release their larvae into the ocean.
I hope this answers your question. Have fun designing your critter!
Allison J. Gong