Next-generation photonics envisions circuitry-free, rapidly reconfigurable systems powered by solitonic beams of self-trapped light and their particlelike interactions. Progress, however, has been limited by the need for reversibly responsive materials that host such nonlinear optical waves. We find that repeatedly switchable self-trapped visible laser beams, which exhibit strong pairwise interactions, can be generated in a photoresponsive hydrogel. Through comprehensive experiments and simulations, we show that the unique nonlinear conditions arise when photoisomerization of spiropyran substituents in pH-responsive poly(acrylamide-
co-acrylic acid) hydrogel transduces optical energy into mechanical deformation of the 3D cross-linked hydrogel matrix. A Gaussian beam self-traps when localized isomerization-induced contraction of the hydrogel and expulsion of water generates a transient waveguide, which entraps the optical field and suppresses divergence. The waveguide is erased and reformed within seconds when the optical field is sequentially removed and reintroduced, allowing the self-trapped beam to be rapidly and repeatedly switched on and off at remarkably low powers in the milliwatt regime. Furthermore, this opto-chemo-mechanical transduction of energy mediated by the 3D cross-linked hydrogel network facilitates pairwise interactions between self-trapped beams both in the short range where there is significant overlap of their optical fields, and even in the long range––over separation distances of up to 10 times the beam width––where such overlap is negligible.