 He sat for the military version of the imperial examination in 1535 and obtained the position of a "wujinshi" (武進士; successful candidate).He was awarded the title of a "qianhu" (千戶; lord over 1,000 households) and appointed as a guard in the imperial palace.In 1555, Yu Dayou, along with the Zhuang noblewoman, Wa Shi, led Ming forces to attack the "wokou" pirates who were raiding near Jiaxing, Zhejiang and defeated about 2,000 of them.