Kesterite-type Cu2ZnSn(S,Se)(4) has been extensively studied over the past several years, with researchers searching for promising candidates for indium- and gallium-free inexpensive absorbers in high-efficiency thin-film solar cells. Many notable experimental and theoretical studies have dealt with the effects of intrinsic point defects, Cu/Zn/Sn nonstoichiometry, and cation impurities on cell performance. However, there have been few systematic investigations elucidating the distribution of oxygen at an atomic scale and the correlation between oxygen substitution and charge transport despite unavoidable incorporation of oxygen from the ambient atmosphere during thin-film fabrication. Using energy-dispersive X-ray spectroscopy, scanning transmission electron microscopy, and electron energy-loss spectroscopy, the presence of nanoscale layers is directly demonstrated in which oxygen is substantially substituted for Se, near grain boundaries in polycrystalline Cu2ZnSnSe4 films. Density-functional theory calculations also show that oxygen substitution remarkably lowers the valence band maximum and subsequently widens the overall bandgap. Consequently, anion modification by oxygen can make a major contribution to the formation of a robust barrier blocking the holes from bulk grains into grain boundaries, thereby efficiently attaining electron-hole separation. The findings provide crucial insights into achieving better energy conversion efficiency in kesterite-based thin-film solar cells through optimum control of oxidation during the fabrication process.