Accumulating observations suggest that peripheral somatosensory ganglia may regulate nociceptive transmission, yet direct evidence is sparse. Here, in experiments on rats and mice, we show that the peripheral afferent nociceptive information in mice undergoes dynamic filtering within the dorsal root ganglion (DRG) and suggest that this filtering occurs at the axonal bifurcations (t-junctions). Using synchronous in vivo electrophysiological recordings from the peripheral and central processes of sensory neurons (in the spinal nerve and dorsal root), ganglionic transplantation of GABAergic progenitor cells, and optogenetics, we demonstrate existence of tonic and dynamic filtering of action potentials traveling through the DRG. Filtering induced by focal application of GABA or optogenetic GABA release from the DRG-transplanted GABAergic progenitor cells was specific to nociceptive fibers. Light-sheet imaging and computer modeling demonstrated that, compared to other somatosensory fiber types, nociceptors have shorter stem axons, making somatic control over t-junctional filtering more efficient. Optogenetically induced GABA release within DRG from the transplanted GABAergic cells enhanced filtering and alleviated hypersensitivity to noxious stimulation produced by chronic inflammation and neuropathic injury in vivo. These findings support "gating" of pain information by DRGs and suggest new therapeutic approaches for pain relief.