The difficulty in assembling or disassembling a long and heavy drill pipe makes it unsuitable to measure parameters of the American Petroleum Institute (API) threads at both ends of the drill pipe. Accordingly, in this paper we propose an on-machine precision measurement method based on a laser displacement sensor (LDS), and then successfully apply it to a certain API thread-repairing machine tool. This method leverages a NC tool rest to drive the LDS so as to acquire the data of the thread axial section contours. Then, the data are reconstructed using a B-spline curve approximation; that is to say, to make the parameterized data better reflect the features of the thread surface, a knot parameterization factor t is introduced to parameterize the LDS data, and the parameterized data are approximated by a B-spline curve using an improved elitist clonal selection algorithm (ECSA). Finally, feature points are extracted using a reconstruction curve, and thread parameters are calculated in real time to determine the machining quality of API threads. Simulation results indicate that the data reconstruction method with parameterization factor t and improved ECSA have high precision in terms of knots adjustment for B-spline curve approximation. A contrastive experiment of NC50 API thread measurement demonstrates that the proposed fitting method can better reflect the features of the thread surface, thereby effectively improving the accuracy of data reconstruction; meanwhile, the experiment also exhibits that the proposed measurement method can complete the on-machine precision measurement of API threads, with a measurement accuracy of ±2 µm and a measurement time of 14.62 s for a 10 mm long thread.