Agricultural green total factor productivity (AGTFP) is vital to sustainable agricultural development (SAD), which plays a pivotal role in achieving high-quality economic growth in China. The current research quantified China’s AGTFP from 2007 to 2019 with the Super-SBM model and the GML index. Subsequently, it examined the impact of environmental regulation (ER) on AGTFP and its heterogeneity. Finally, this study developed a mediating effect model and a panel threshold model to investigate the role of technological innovation (TI) in affecting environmental regulation (ER) on AGTFP. The findings indicate that the following: (1) The average annual growth rate of AGTFP is 7.84%, which is mostly driven by green technological innovation progress. (2) ER has a significant positive impact on AGTFP with noticeable regional differences. The eastern and central regions experience a more substantial promotion effect compared to the western region. Additionally, the prominent grain-producing areas and main grain-marketing areas have a more significant promotion effect compared to the grain-balanced areas. The promotion effect of heterogeneous ER on AGTFP varies, with the effects of command-and-control environmental regulation (ERC), market-based incentives for environmental regulation (ERM), and public participation regulation (ERP) decreasing in magnitude. (3) The mechanism analysis reveals that promoting TI is a crucial way to enhance AGTFP through ER. There exists a notable dual threshold for TI in ER, encompassing both ERC and ERM. Moreover, AGTFP becomes increasingly pronounced. This study presents a novel perspective for promoting SAD, with a focus on the rise in AGTFP and the path to achieving it