Globally speaking, waste acid neutralization is a widely used industrial pollution control process. In principle, acid–base neutralization is a thermodynamically favorable reaction that involves the association of hydrogen and hydroxyl ions to form neutral water molecules with the generation of a significant amount of thermal energy (ΔH = −55.84 kJ/mol). However, it is not possible to recover the energy, because the increase in temperature of the bulk solution phase is often miniscule, because of the diluted nature of the waste acid solution and the high specific heat of water. Here, we demonstrate a methodology to recover a significant amount of useful energy by carrying out the neutralization reaction inside a pH-sensitive hydrophilic polymer (or biopolymer) phase containing covalently attached weak-acid or weak-base functional groups. When contacted with an acid or a base, the variation of pH causes the functional groups to reversibly acquire and lose its ionic character. This gives rise to an on–off pattern regarding the generation of osmotic pressure inside the polymer phase, causing it to reversibly swell and shrink, because of the movement of water into and out of the polymer phase. Laboratory experiments validate the reversibility of the swelling–shrinking pattern of a commercial weak-acid ion-exchange resin for multiple numbers of cycles with a concomitant generation of mechanical energy during the neutralization reaction. The process can be enhanced by tailoring the cross-linking and hydrophilicity of the polymer phase. The energy generated is free of carbon emission.