Optogenetics allows rapid, temporally specific control of neuronal activity by targeted expression and activation of light-sensitive proteins. Implementation typically requires remote light sources and fiber-optic delivery schemes that impose considerable physical constraints on natural behaviors. In this report we bypass these limitations using technologies that combine thin, mechanically soft neural interfaces with fully implantable, stretchable wireless radio power and control systems. The resulting devices achieve optogenetic modulation of the spinal cord and peripheral nervous system. This is demonstrated with two form factors; stretchable film appliqués that interface directly with peripheral nerves, and flexible filaments that insert into the narrow confines of the spinal epidural space. These soft, thin devices are minimally invasive, and histological tests suggest they can be used in chronic studies. We demonstrate the power of this technology by modulating peripheral and spinal pain circuitry, providing evidence for the potential widespread use of these devices in research and future clinical applications of optogenetics outside the brain.