It has long been hypothesized that benthic motile pennate diatoms use phototaxis to optimize photosynthesis and minimize photoinhibitory damage by adjusting their position within vertical light gradients in coastal benthic sediments. However, experimental evidence to test this hypothesis remains inconclusive, mainly due to methodological difficulties in studying cell behavior and photosynthesis over realistic spatial microscale gradients of irradiance and cell position. In this study, a novel experimental approach was developed and used to test the hypothesis of photosynthesis optimization through motility, based on the combination of single-cell in vivo chlorophyll fluorometry and microfluidic chips. The approach allows the concurrent study of behavior and photosynthetic activity of individual cells of the epipelic diatom species Craspedostauros britannicus exposed to a light microgradient of realistic dimensions, simulating the irradiance and distance scales of light microgradients in benthic sediments. Following exposure to light, (i) cells explored their light environment before initiating light-directed motility; (ii) cells used motility to lower their light dose, when exposed to the highest light intensities; and (iii) motility was combined with reversible non-photochemical quenching, to allow cells to avoid photoinhibition. The results of this proof-of-concept study not only strongly support the photoprotective nature of photobehavior in the studied species but also revealed considerable variability in how individual cells reacted to a light microgradient. The experimental setup can be readily applied to study motility and photosynthetic light responses of other diatom species or natural assemblages, as well as other photoautotrophic motile microorganisms, broadening the toolset for experimental microbial ecology research.