Sensory feedback during movement entails sensing a mix of externally- and self-generated stimuli (respectively, exafference and reafference). In many peripheral sensory systems, a parallel copy of the motor command, a corollary discharge, is thought to eliminate sensory feedback during behaviors. However, reafference has important roles in motor control, because it provides real-time feedback on the animal's motions through the environment. In this case, the corollary discharge must be calibrated to enable feedback while avoiding negative consequences like sensor fatigue. The undulatory motions of fishes' bodies generate induced flows that are sensed by the lateral line sensory organ, and prior work has shown these reafferent signals contribute to the regulation of swimming kinematics. Corollary discharge to the lateral line reduces the gain for reafference, but cannot eliminate it altogether. We develop a data-driven model integrating swimming biomechanics, hair cell physiology, and corollary discharge to understand how sensory modulation is calibrated during locomotion in larval zebrafish. In the absence of corollary discharge, lateral line afferent units exhibit the highly heterogeneous habituation rates characteristic of hair cell systems, typified by decaying sensitivity and phase distortions with respect to an input stimulus. Activation of the corollary discharge prevents habituation, reduces response heterogeneity, and regulates response phases in a narrow interval around the time of the peak stimulus. This suggests a synergistic interaction between the corollary discharge and the polarization of lateral line sensors, which sharpens sensitivity along their preferred axes. Our integrative model reveals a vital role of corollary discharge for ensuring precise feedback, including proprioception, during undulatory locomotion.