The spatiotemporal regulation of light-gated ion channels is a powerful tool to study physiological pathways and develop personalized theranostic modalities. So far, most existing light-gated channels are limited by their action spectra in the ultraviolet (UV) or visible region. Simple and innovative strategies for the specific attachment of photoswitches on the cell surface without modifying or genetically encoding channel structures, and more importantly, that enable the remote activation of ion-channel functions within near-infrared (NIR) spectral window in living systems, remain a challenging concern. Herein, metabolic glycan biosynthesis is used to achieve site-specific covalent attachment of near-infrared-light-mediated lanthanide-doped upconversion nanocrystals (UCNs) to the cell surface through copper-free click cyclization. Upon irradiation with 808 nm light, the converted emission at 480 nm could activate a light-gated ion channel, channelrhodopsins-2 (ChR2), and thus remotely control the cation influx. This unique strategy provides valuable insights on the specific regulation membrane-associated activities in vivo.