With a nervous system of only 302 neurons, the free-living nematode Caenorhabditis elegans is a powerful experimental organism for neurobiology. However, the laboratory substrate commonly used in C. elegans research, a planar agarose surface, fails to reflect the complexity of this organism's natural environment, complicates stimulus delivery, and is incompatible with high-resolution optophysiology experiments. Here we present a new class of microfluidic devices for C. elegans neurobiology and behavior: agarose-free, micron-scale chambers and channels that allow the animals to crawl as they would on agarose. One such device mimics a moist soil matrix and facilitates rapid delivery of fluid-borne stimuli. A second device consists of sinusoidal channels that can be used to regulate the waveform and trajectory of crawling worms. Both devices are thin and transparent, rendering them compatible with high-resolution microscope objectives for neuronal imaging and optical recording. Together, the new devices are likely to accelerate studies of the neuronal basis of behavior in C. elegans.