Carbon sources have been reported to determine the bio-demulsifying performance and mechanisms. However, the genetic regulation of carbon sources-mediated bio-demulsification remains unclear. Here, the effects of β-oxidation, stress response, and nitrate metabolism on the demulsification of alkaline-surfactant-polymer flooding produced water by Gordonia sp. TD-4 were investigated. The results showed that competitive adsorption-derived demulsification was mediated by oil-soluble carbon sources (paraffin). Surface-active lipopeptides responsible for competitive adsorption-derived demulsification could be biosynthesized by the nonribosomal peptide synthetases and polyketide synthases using oil-soluble carbon sources. Bio-flocculation-derived demulsification was mediated by water-soluble carbon sources. Water-soluble carbon sources (sodium acetate and glucose) mediated the process of the dissimilatory reduction of nitrate to ammonia, which resulted in the variable accumulation of nitrite. The accumulated nitrite (>180 mg-N/L) stimulated stress response and induced the upregulation of chaperone-associated genes. The upregulation of chaperonins increased the cell surface hydrophobicity and the cation-dependent bio-flocculating performance, which were responsible for bio-flocculation-derived demulsification. The β-oxidation of fatty acids significantly affected both competitive adsorption-derived demulsification and bio-flocculation-derived demulsification. This study illustrates the synergistic effects of nitrogen sources and carbon sources on the regulation of bio-demulsifying mechanisms of TD-4 and identifies two key functional gene modules responsible for the regulation of bio-demulsifying mechanisms.