Oxytocin (OT), a hypothalamic neuropeptide that acts as a neuromodulator in the brain, orchestrates a variety of animal behaviors. However, the relationship between brain OT dynamics and complex animal behaviors remains largely elusive, partly because of the lack of a suitable technique for its real-time recording in vivo. Here, we describe a G protein-coupled receptor-based green fluorescent OT sensor with a large dynamic range, optimal affinity, ligand specificity to OT orthologs, minimal effects on downstream signaling, and long-term fluorescence stability. By combining viral gene delivery and fiber photometry-mediated fluorescence measurements, we demonstrated the utility of the sensor for real-time detection of brain OT dynamics in living mice. Importantly, our measurements revealed “OT oscillation,” a hitherto unknown rhythmic change in OT levels in the brain. The new fluorescent OT sensor will allow the analysis of OT dynamics in a wide variety of physiological and pathological processes.