Sun Yuting was from Jining, Shandong Province. He sat for the palace-level imperial examination in 1775 and obtained the position of a tong jinshi chushen. He was admitted to the Hanlin Academy, where he served as a shujishi. In August 1802, he was promoted from buzhengshi of Hubei Province to Provincial Governor of Guangxi Province. On 29 October 1803, he was reassigned to serve as the Provincial Governor of Guangdong Province. Around December 1804, he was transferred back to Guangxi, but was relocated back to Guangdong on 4 July 1805 until 1808. In 1810, Sun Yuting was appointed as the Provincial Governor of Yunnan Province before he was later promoted to Viceroy of Huguang and then Viceroy of Liangjiang. In March 1821, while serving as Viceroy of Liangjiang, he was also given the honorary title of Assisting Grand Secretary. In August 1824, he was promoted to Grand Secretary of Tiren Cabinet. However, he was subsequently dismissed from office in 1824 due to a breach in the Yellow River embankment, which was under his supervision. In July 1825, Sun Yuting was restored to the civil service as a bianxiu in the Hanlin Academy under the xiuzhi system for retired officials. In 1834, he was awarded the privilege of wearing the hat of a fourth-grade official. He died in the same year at the age of 82. During his tenure as Provincial Governor of Guangdong, Sun Yuting put down the Shantou clan fights and tried to eliminate the practice of bribing pirates into submitting to the government. In 1802, as Provincial Governor of Guangxi, he urged the Qing imperial court to recognise Fu Yang, the de facto king of Annam, and allow Annam to be again called Nanyue. In 1816, when Lord Amherst visited the Jiaqing Emperor's court as England's ambassador extraordinary to China, Sun Yuting advised the Jiaqing Emperor to exempt Amherst from the customary prostrations and kowtowing for foreign ambassadors to the Emperor. At the same time, he assured the Jiaqing Emperor that the English could not live without tea, and that to prohibit tea exports from China would soon bring England to its knees.
Family
Sun Yuting's family was an elite family of scholar-bureaucrats who served in high-ranking positions in the Qing government for over three generations. Since 1804, they had also been running a family business, Yutang Jiangyuan, which is now known as the . Sun Yuting's father, Sun Kuotu, obtained a juren position in the imperial examination in 1735. He served as the Magistrate of Qiantang County and was a friend of the painter Zheng Xie. Sun Yuting's eldest son, Sun Shanbao, obtained a juren position in the imperial examination and served as a Vice Secretary of Justice and Provincial Governor of Jiangsu Province. Sun Yuting's second son was Sun Renrong. Sun Renrong's son, Sun Yuyan, emerged as the top candidate in the imperial examination in 1844 and served as the anchashi of Zhejiang Province. Sun Yuting's third son, Sun Ruizhen, obtained a jinshi position in the imperial examination in 1823 and served in the Hanlin Academy and as Secretary of Revenue. Sun Ruizhen's son, Sun Yuwen, obtained the second highest position in the imperial examination in 1856 and served as Secretary of Defence and head of the Zongli Yamen. One of Sun Ruizhen's grandsons, Sun Ji, obtained a jinshi position in the imperial examination in 1852 and served as the Prefect of Shuntian Prefecture.