This paper presents a two-stage microencapsulation process that uses pH modulation to enhance the thermal stability of microcapsules that consist of a melamine-formaldehyde (MF) shell and a butyl stearate core. In the first stage, the pH value was modulated between 6.0 and 8.0. Rising the pH value to 8.0 slowed the polycondensation rate, allowing the MF resin with a lower degree of polymerization to migrate to the capsule surface and form a smooth shell. Lowering the pH value to 6.0 accelerated polycondensation. In the second stage, a relatively fast, continuous reduction in the pH value to 5.0 led to further MF polycondensation, hardening the shell. Post-curing at 100 °C prevented shell damage caused by the liquid-gas phase transition of the core material during the process. The microcapsules produced by increasing the pH value to 8.0 twice demonstrated improved thermal stability, with only a minimal overall weight loss of 5% at 300 °C. Significant weight loss was observed between 350 and 400 °C, temperatures at which the methylene bridges in the MF shell undergo thermal degradation. The results from differential scanning calorimetry, electron microscopy, and thermogravimetry analyses confirmed a successful optimization of the microencapsulation, showing that these microcapsules are promising for thermal energy storage and other applications that require high thermal stability.