The near-infrared-IIb (NIR-IIb) (1,500–1,700 nm) window is ideal for deep-tissue optical imaging in mammals, but lacks bright and biocompatible probes. Here, we developed biocompatible cubic-phase (α-phase) erbium-based rare-earth nanoparticles (ErNPs) exhibiting bright downconversion luminescence at ~1,600 nm for dynamic imaging of cancer immunotherapy in mice. We used ErNPs functionalized with cross-linked hydrophilic polymer layers attached to anti-PD-L1 (programmed cell death-1 ligand-1) antibody for molecular imaging of PD-L1 in a mouse model of colon cancer and achieved tumor-to-normal tissue signal ratios of ~40. The long luminescence lifetime of ErNPs (~4.6 ms) enabled simultaneous imaging of ErNPs and lead sulfide quantum dots emitting in the same ~1,600 nm window. In vivo NIR-IIb molecular imaging of PD-L1 and CD8 revealed cytotoxic T lymphocytes in the tumor microenvironment in response to immunotherapy, and altered CD8 signals in tumor and spleen due to immune activation. The cross-linked functionalization layer facilitated 90% ErNP excretion within 2 weeks without detectable toxicity in mice. Biocompatible rare-earth nanoparticles with an emission maximum at 1,600 nm enable sensitive in vivo imaging.