As the digital economy increasingly dominates a substantial portion of the national economy, comprehending its role in promoting sustainable development has become an imperative research question—particularly in the context of the Yellow River Basin, where there exists an urgent need to shift toward more sustainable modes of economic growth. Utilizing panel data spanning from 1999 to 2020 for 114 cities in the Yellow River Basin, this study develops a comprehensive evaluation framework for sustainable development, incorporating economic, social, and ecological dimensions. The empirical findings reveal that the digital economy acts as a catalyst for sustainable development. Importantly, these results withstand both endogeneity tests and robustness checks. Further heterogeneity analysis indicates that the positive impact of the digital economy on sustainable development is more pronounced in regions directly traversed by the Yellow River and in areas with higher sustainability levels. Moreover, the enactment and implementation of the 13th Five-Year National Information Plan have emphasized the role of the digital economy in enhancing sustainable development. Mechanism tests also illustrate those elevated levels of personal digital acceptance and government intervention contribution to amplify the digital economy’s positive impact on sustainable development. In conclusion, policy recommendations are put forward, including optimizing industrial structure, strengthening data governance and environmental monitoring, promoting innovation-driven development, and fostering collaborative growth.