In this work, BiOCl and BiOBr photocatalysts containing abundant O vacancies were synthesized for photocatalytic reduction of nitrogen to ammonia. The experimental results show that the ammonia generation rates of BiOCl and BiOBr constructed with O vacancies reach 40.51 μmol g−1 h−1 and 49.66 μmol g−1 h−1, respectively, which are significantly higher than those of pure BiOCl and BiOBr. The band gap, XPS characterization, and DFT calculations demonstrate that O vacancies narrow the band gap of BiOX and reduce the energy requirement for visible−light excited carrier generation. As a chemisorption site, it is not only a place where photogenerated electrons are enriched, but also promotes the transfer of more photogenerated electrons to N2 molecules through the O vacancies, thereby promoting the photocatalytic N2 reduction reaction.