Phototaxis, the process through which motile organisms direct their swimming toward or away from light, is implicated in key ecological phenomena (including algal blooms and diel vertical migration) that shape the distribution, diversity, and productivity of phytoplankton and thus energy transfer to higher trophic levels in aquatic ecosystems. Phototaxis also finds important applications in biofuel reactors and microbiopropellers and is argued to serve as a benchmark for the study of biological invasions in heterogeneous environments owing to the ease of generating stochastic light fields. Despite its ecological and technological relevance, an experimentally tested, general theoretical model of phototaxis seems unavailable to date. Here, we present accurate measurements of the behavior of the alga Euglena gracilis when exposed to controlled light fields. Analysis of E. gracilis' phototactic accumulation dynamics over a broad range of light intensities proves that the classic Keller-Segel mathematical framework for taxis provides an accurate description of both positive and negative phototaxis only when phototactic sensitivity is modeled by a generalized "receptor law," a specific nonlinear response function to light intensity that drives algae toward beneficial light conditions and away from harmful ones. The proposed phototactic model captures the temporal dynamics of both cells' accumulation toward light sources and their dispersion upon light cessation. The model could thus be of use in integrating models of vertical phytoplankton migrations inmarine and freshwater ecosystems, and in the design of bioreactors.