In multiple-pass nonlinear frequency conversion devices, interacting waves may accumulate different phases, owing to dispersive elements in the system. Phase compensation is therefore necessary for efficient frequency conversion. We experimentally demonstrate phase compensation in a compact semimonolithic frequency-doubling cavity by using a periodically poled KTP crystal. The conversion efficiency of the crystal was found to decrease at high pump powers, owing to power-dependent thermal lensing. This experimental observation was supported by a theoretical calculation of the conversion efficiency in a cavity, considering the mismatch between the mode's thermally loaded and unloaded cavities. A design procedure was also presented to compensate for the thermal lensing effect. The highest conversion efficiency of 56.5%, corresponding to a second-harmonic power of 117.5 mW at 532 nm, was achieved with a cw Nd:YAG pump power of 208 mW.