Herbicide residues in farmland soils have attracted a great deal of attention in recent decades. Their accumulation potentially decreases the activity of microbes and related enzymes, as well as disturbs the nitrogen cycle in farmland soils. In previous studies, the influence of natural factors or nitrogen fertilization on the soil nitrogen cycle have frequently been examined, but the role of herbicides has been ignored. This study was conducted to examine the effects of herbicides on NH3 volatilization- and denitrification-related nitrogen loss through three rotation cycles from 2013 to 2016. The four treatments included no urea fertilizer (CK), urea (CN), urea+acetochlor-fenoxaprop-ethyl (AC-FE), and urea+2,4D-dicamba (2,4D-DI) approaches. The results showed that the application of nitrogen fertilizer significantly increased the nitrogen losses from ammonia volatilization and denitrification in the soil. Ammonia volatilization was the main reason for the gaseous loss of urea nitrogen in a wheat–maize rotation system in the North China Plain (NCP), which was significantly higher than the denitrification loss. In the CK treatment, the cumulative nitrogen losses from ammonia volatilization and denitrification during the three crop rotation cycles were 66.64 kg N hm−2 and 8.07 kg N hm−2, respectively. Compared with CK, the nitrogen losses from ammonia volatilization and denitrification under the CN treatment increased 52.62% and 152.88%, respectively. The application of AC-FE and 2,4D-DI significantly reduced the nitrogen gas losses from the ammonia volatilization and denitrification in the soil. Ammonia volatilization reduction mainly occurred during the maize season, and the inhibition rates of AC-FE and 2,4D-DI were 7.72% and 11.80%, respectively, when compared with CN. From the perspective of the entire wheat–maize rotation cycle, the inhibition rates were 5.41% and 7.23% over three years, respectively. Denitrification reduction also mainly occurred in the maize season, with the inhibition rates of AC-FE and 2,4D-DI being 34.12% and 30.94%, respectively, when compared with CN. From the perspective of the entire wheat–maize rotation cycle, the inhibition rates were 28.39% and 28.58% over three years, respectively. Overall, this study demonstrates that herbicides could impact the nitrogen cycle of farmland soil ecosystems via the suppression of ammonia volatilization and denitrification rates, thus reducing gaseous N losses and mitigating global climate change.