Optogenetics is a novel biotechnology widely used to precisely manipulate a specific peripheral sensory neuron or neural circuit. However, the use of optogenetics to assess the therapeutic efficacy of analgesics is elusive. In this study, we generated a transgenic mouse stain in which all primary somatosensory neurons can be optogenetically activated to mimic neuronal hyperactivation in the neuropathic pain state for the assessment of analgesic effects of drugs. A transgenic mouse was generated using the advillin-Cre line mated with the Ai32 strain, in which channelrhodopsin-2 fused to enhanced yellow fluorescence protein (ChR2-EYFP) was conditionally expressed in all types of primary somatosensory neurons (advillincre/ChR2+/+). Immunofluorescence and transdermal photostimulation on the hindpaws were used to verify the transgenic mice. Optical stimulation to evoke pain-like paw withdrawal latency was used to assess the analgesic effects of a series of drugs. Injury- and pain-related molecular biomarkers were investigated with immunohistofluorescence. We found that the expression of ChR2-EYFP was observed in many primary afferents of paw skin and sciatic nerves and in primary sensory neurons and laminae I and II of the spinal dorsal horns in advillincre/ChR2+/+ mice. Transdermal blue light stimulation of the transgenic mouse hindpaw evoked nocifensive paw withdrawal behavior. Treatment with gabapentin, some channel blockers, and local anesthetics, but not opioids or COX-1/2 inhibitors, prolonged the paw withdrawal latency in the transgenic mice. The analgesic effect of gabapentin was also verified by the decreased expression of injury- and pain-related molecular biomarkers. These optogenetic mice provide a promising model for assessing the therapeutic efficacy of analgesics in neuropathic pain.