The intrinsic magnetic topological insulator MnBi2Te4 provides a feasible pathway to the high-temperature quantum anomalous Hall (QAH) effect as well as various novel topological quantum phases. Although quantized transport properties have been observed in exfoliated MnBi2Te4 thin flakes, it remains a big challenge to achieve molecular beam epitaxy (MBE)-grown MnBi2Te4 thin films even close to the quantized regime. In this work, we report the realization of quantized anomalous Hall resistivity in MBE-grown MnBi2Te4 thin films with the chemical potential tuned by both controlled in situ oxygen exposure and top gating. We find that elongated post-annealing obviously elevates the temperature to achieve quantization of the Hall resistivity, but also increases the residual longitudinal resistivity, indicating a picture of high-quality QAH puddles weakly coupled by tunnel barriers. These results help to clarify the puzzles in previous experimental studies on MnBi2Te4 and to find a way out of the big difficulty in obtaining MnBi2Te4 samples showing quantized transport properties. [ABSTRACT FROM AUTHOR]