Throughout the oceans, small fish and other micronekton migrate between daytime depths of several hundred meters and near-surface waters at night. These diel vertical migrations of mesopelagic organisms structure pelagic ecosystems through trophic interactions, and are a key element in the biological carbon pump. However, depth distributions and migration amplitude vary greatly. Suggested proximate causes of the migration such as oxygen, temperature, and light often correlate and therefore the causal underpinnings have remained unclear. Using mesopelagic fishes and the Norwegian Sea as a study system, we developed a dynamic state variable model that finds optimal migration patterns that we validate with acoustic observations along a latitudinal gradient. The model describes predation risk and bioenergetics, and maximizes expected energy surplus, a proxy for Darwinian fitness. The model allows us to disentangle the drivers of migration and make predictions about depth distribution and related fitness consequences along a latitudinal trajectory with strong gradients in environmental drivers and vertical distribution of scattering layers. We show that the model-predicted vertical migration of mesopelagic fishes matches that observed along this transect. For most situations, modelled mesopelagic fish behaviour can be well described by a light comfort zone near identical to that derived from observations. By selectively keeping light or temperature constant, the model reveals that temperature, in comparison with light, has little effect on depth distribution. We find that water clarity, which limits how deeply light can penetrate into the ocean, structures daytime depths, while surface light at night controlled the depth of nocturnal ascents.