Many animals generate propulsive forces by coordinating legs, which contact and push against the surroundings, with bending of the body, which can only indirectly influence these forces. Such body–leg coordination is not commonly employed in quadrupedal robotic systems. To elucidate the role of back bending during quadrupedal locomotion, we study a model system: the salamander, a sprawled-posture quadruped that uses lateral bending of the elongate back in conjunction with stepping of the limbs during locomotion. We develop a geometric approach that yields a low-dimensional representation of the body and limb contributions to the locomotor performance quantified by stride displacement. For systems where the damping forces dominate inertial forces, our approach offers insight into appropriate coordination patterns, and improves the computational efficiency of optimization techniques. In particular, we demonstrate effect of the lateral undulation coordinated with leg movement in the forward, rotational, and lateral directions of the robot motion. We validate the theoretical results using numerical simulations, and then successfully test these approaches using robophysical experiments on granular media, a model deformable, frictional substrate. Although our focus lies primarily on robotics, we also demonstrate that our tools can accurately predict optimal body bending of a living salamander Salamandra salamandra.