The passively Q-switched laser operation was realized in Yb:YPO4 crystals with a few-layer MoS2 serving as saturable absorber. With the output coupling of T = 5%, a laser pulse of 0.29 W was obtained. The pulse energy, pulse width and peak power were respectively 0.33 μJ, 77 ns and 4.29 W. In addition, efficient continuous-wave (CW) lasers were also achieved. When the absorption pump power was 4.3 W, a CW laser output power of 1.71 W was generated with a slope efficiency of 44.3%. The current results demonstrate that Yb:YPO4 is a kind of microchip laser material with great application potential.