Unlike command-based, market-based, and voluntary-based environmental regulations, credit-based environmental regulation leverages social credit to foster sustainable development. Drawing on panel data from Chinese A-share listed companies spanning 2010 to 2022, this study employs a multi-period difference-in-differences (DID) approach to examine how credit-based environmental regulation influences enterprise total factor productivity (TFP), leveraging the implementation of China's Environmental Credit Evaluation Policy (ECEP) as a quasi-natural experiment. The findings indicate that the ECEP significantly enhances enterprise TFP. Mechanism analysis reveals that the ECEP enhances enterprise TFP by optimizing capital allocation efficiency and stimulating green technology innovation. Cross-sectional analysis demonstrates that the ECEP's TFP enhancement effect is more pronounced in regions with rigorous environmental enforcement and superior green credit, in industries with intense market competition, and among firms with weak internal controls. Overall, this study underscores the significance of credit-based environmental regulation in advancing green development.