We herein report a rigid nested metal–organic framework (MOF) featuring a unique thermoresponsive gating adsorption behavior, which, in contrast to any known flexibility modes for stimuli-responsive MOFs, depends on the thermal motion of the extra-framework counterions. In addition, this MOF also exhibits adsorption selectivity of CO2 over N2, H2, and Ar at 273 K, thus enabling a strategic separation and encapsulation of CO2.