The opportunistic pathogen Pseudomonas aeruginosa explores surfaces using twitching motility powered by retractile extracellular filaments called type IV pili (T4P). Single cells twitch by sequential T4P extension, attachment, and retraction. How single cells coordinate T4P to efficiently navigate surfaces remains unclear. We demonstrate that P. aeruginosa actively directs twitching in the direction of mechanical input from T4P in a process called mechanotaxis. The Chp chemotaxis-like system controls the balance of forward and reverse twitching migration of single cells in response to the mechanical signal. Collisions between twitching cells stimulate reversals, but Chp mutants either always or never reverse. As a result, while wild-type cells colonize surfaces uniformly, collision-blind Chp mutants jam, demonstrating a function for mechanosensing in regulating group behavior. On surfaces, Chp senses T4P attachment at one pole, thereby sensing a spatially resolved signal. As a result, the Chp response regulators PilG and PilH control the polarization of the extension motor PilB. PilG stimulates polarization favoring forward migration, while PilH inhibits polarization, inducing reversal. Subcellular segregation of PilG and PilH efficiently orchestrates their antagonistic functions, ultimately enabling rapid reversals upon perturbations. The distinct localization of response regulators establishes a signaling landscape known as local excitation-global inhibition in higher-order organisms, identifying a conserved strategy to transduce spatially resolved signals.