In the United States, over 1.5 million people live with lower-limb amputation. Existing prosthetic limbs do not restore somatosensory feedback from the limb, resulting in functional impairments including balance deficits and an increased risk of falls. Further, these prostheses do not alleviate the severe phantom limb pain that often follows amputation. Leveraging clinically available spinal cord stimulation electrodes, we designed a system that restores somatosensation in the missing limb, thereby improving balance and gait and reducing phantom limb pain. We show that spinal cord stimulation can evoke sensations in the missing foot and that we can control the location and intensity of those sensations. Further, by modulating stimulation intensity in real time based on signals from a wireless pressure-sensitive shoe insole, subjects exhibit improvements in functional measures of balance and gait stability. Finally, over the duration of the implant period, subjects experienced a clinically meaningful decrease in phantom limb pain. These combined results demonstrate that, with an electrode technology that is currently in widespread clinical use, our approach has the potential to become an important intervention for lower-limb amputation.