Multiple-plane phase retrieval method can recover the complete complex amplitude of the optical field by recording a series of axial diffraction patterns at different distances. However, accurate measurement of the initial distance from the object to the sensor, which is important for high-precision reconstruction, is still difficult. In this paper, we propose to use the diffraction of grating to determine the initial distance. The object is firstly replaced by a transmission grating, and the corresponding diffraction pattern on the first measurement plane is captured. Then combining the grating equation, the initial distance can be obtained. On this basis, the object plane is included in the iterative process. Compared with the original method which only iterates between the measurement planes, the recovered optical field with the proposed method has higher accuracy, better robust to noise, and can avoid the time-consuming digital refocusing process. Numerical simulations and optical experiments are carried out to prove the effectiveness of the proposed method.