In this paper, an optical switch based on a microelectromechanical phase modulator is presented. Phase tuning is achieved by tuning the vertical gap between two vertically coupled waveguides through the application of a reverse bias on a p-i-n junction. An effective refractive index tuning Δneff of 0.03 and a phase shift of more than 3π rad at telecom wavelengths are measured with an on-chip Mach–Zehnder interferometer (MZI), with a phase-tuning length of only 140 μm. With a bias voltage of 5.1 V, a half-wave-voltage-length product (Vπ L) of 5.6 × 10−3 V·cm is achieved. Furthermore, optical crossbar switching in a MZI is demonstrated with a 15 dB extinction ratio using an actuation voltage of only 4.2 V. Our work provides a solution to on-chip, low-voltage phase modulation and optical switching. The switch is fabricated on an indium-phosphide membrane on a silicon substrate, which enables the integration with active components (e.g., amplifiers, lasers, and detectors) on a single chip.