As a new business model, E-commerce brings new changes to the global economy and society. So, can E-commerce development policies promote high-quality agricultural development? This article regards the pilot construction of national e-commerce demonstration cities as a quasi-natural experiment for the development of e-commerce. Based on the E-commerce pilot and economic and social development data of national prefecture-level cities from 2004 to 2018, the agricultural total factor productivity calculated by the Fare-Primont index method is used as the characterization of the quality of urban agricultural development, and an empirical model is constructed under the progressive Differences-in-Differences framework. This paper empirically tests the overall impact of E-commerce development on the high-quality development of agriculture and its sources, analyzes the heterogeneity and dynamics of the impact, and investigates the possible impact mechanism. The result shows that from the overall impact and its sources, the development of E-commerce in cities has a positive impact on the high-quality development of agriculture, and the impact is mainly due to its role in promoting technological innovation and economies of scale. From the perspective of heterogeneity, the larger the population size of a city, the more significant the level of e-conomic development or Internet development. From the perspective of the dynamic impact, the positive impact of e-commerce development becomes more significant over time. With the passage of time, the impact of E-commerce on high-quality agricultural development policies shows a trend of first increasing and then decreasing. Overall, this study provides empirical evidence for the rationality and effectiveness of policies and measures related to E-commerce to promote the high-quality development of agriculture.