The technique of generating sinusoidal fringe patterns by defocusing squared binary structured ones has numerous merits for high-speed three-dimensional (3D) shape measurement. However, it is challenging for this method to realize a multifrequency phase-shifting (MFPS) algorithm because it is difficult to simultaneously generate high-quality sinusoidal fringe patterns with different periods. This paper proposes to realize an MFPS algorithm utilizing an optimal pulse width modulation (OPWM) technique that can selectively eliminate high-order harmonics of squared binary patterns. We successfully develop a 556 Hz system utilizing a three-frequency algorithm for simultaneously measuring multiple objects.