We demonstrate the use of hydrogel swelling as a mechanism to reversibly induce solvatochromic shifting in single-walled carbon nanotube (SWNT) near-infrared emission within a biocompatible hydrogel. The optical sensor reports the degree of the swelled state and glucose concentration when apo-glucose oxidase is used to cross-link the hydrogel, Photoluminescence emission maxima from dispersed nanotubes in a poly(vinyl alcohol) hydrogel shift as cross-linking is increased, with a maximum of -48 meV for the (6,5) nanotube. The Raman tangential mode also red shifts up to 17 cm(-1), indicative of nanotube lattice strain equivalent to an effective hydrostatic pressure of 3 GPa. While the electronic band gaps of SWNTs are known to either increase or decrease with uniaxial strain or lattice deformation depending on chiral vector, we show that the mechanism of detection is counterintuitively non-strain-dependent. Instead, the data are well-described by a model that accounts for changes in dielectric screening of the 1-D exciton, as the osmotic pressure forces conformational distortions in the PVA by rotating more polar groups to the nanotube surface. The model describes observed changes with hydration state and cross-linking density variation from 0 to 14%. Cross-linking with apo-glucose oxidase renders the hydrogel glucose responsive, and we demonstrate rapid and reversible detection of glucose from these systems after repeated cycling of 10 mM glucose. We also demonstrate detection and imaging in the near-infrared of implanted hydrogel sensors in a mouse tissue model, showing excellent signal-to-noise of 8.6 and contrast with integration times of 60 s.