A phase error compensation method is proposed for phase measurement profilometry. The gamma nonlinearity of a projector–camera pair can induce higher-order harmonics in a deformed pattern, resulting in periodic phase errors in the unwrapped phase map. To reduce the phase error caused by gamma nonlinearity, a model relating the phase error and practical wrapped phase is established, and a phase matrix for compensation is obtained based on the model instead of solving the gamma value of the projector–camera pair (γ). In addition, the compensation accuracy theoretically decreases with the ratio of the third-harmonic coefficient to the fundamental frequency components of the deformed pattern (β). The simulated measurement shows that the root-mean-square (RMS) before and after compensation is 0.0052 and 2.6840 × 10 − 4 rad when β is 0.0063, respectively, and it is 0.0755 and 0.0175 rad when β is 0.0880, respectively. The experimental results indicate that the RMS of the unwrapped phase in a uniform plane before and after compensation is 0.0639 and 0.0156 rad, respectively, when β is ∼0.09 using the proposed method. The periodic phase error caused by gamma nonlinearity decreases dramatically using the proposed method.