The photocatalytic activity of graphitic carbon nitride (g-C3N4) is restricted by its inherent shortcomings. Nitrogen (N) vacancies and crystallinity are two effective options to enhance the photocatalytic activity of g-C3N4. In this paper, oxalyl dihydrazide (ODH) was introduced as an environmental atmosphere control agent for the synthesis of N vacancies g-C3N4 with increased crystallinity. The increased crystallinity and N vacancies can effectively contribute to interlayer and intralayer exciton dissociation and charge transfer, respectively. They can modulate electronic band structure to boost visible light harvesting. The obtained visible-light (λ > 420 nm) photocatalytic efficiency of ODH-CN2 for tetracycline hydrochloride (TC-HCl) and sulfamethoxazole (SMZ) degradation was 79.9% (60 min) and 91.5% (120 min), respectively. These results are 39.8% and 36.7% higher than that of traditional g-C3N4 (CN), respectively. Moreover the visible-light photocatalytic H2 evolution rate of ODH-CN2 in triethanolamine solution with 3% Pt reached 5833.1 μmol h−1 g−1, approximately 4 times higher than that of CN. Subsequently, TC-HCl or SMZ were used as hole sacrificial agents to realize simultaneous H2 evolution and degradation of TC-HCl or SMZ over ODH-CN2 with 3% Pt. This study proposes promoting the photocatalytic activity of g-C3N4 by using an environmental atmosphere control agent to simultaneously form N vacancies and increase crystallinity, thus accelerating interlayer and intralayer exciton dissociation and charge transfer, respectively.