The Earth’s upper atmosphere has shown signs of cooling and contraction over the past decades. This is generally attributed to the increasing level of atmospheric CO2, a coolant in the upper atmosphere. However, especially the charged part of the upper atmosphere, the ionosphere, also responds to the Earth’s magnetic field, which has been weakening considerably over the past century, as well as changing in structure. The relative importance of the changing geomagnetic field compared to enhanced CO2 levels for long-term change in the upper atmosphere is still a matter of debate. Here we present a quantitative comparison of the effects of the increase in CO2 concentration and changes in the magnetic field from 1908 to 2008, based on simulations with the Thermosphere-Ionosphere-Electrodynamics General Circulation Model (TIE-GCM). This demonstrates that magnetic field changes contribute at least as much as the increase in CO2 concentration to changes in the height of the maximum electron density in the ionosphere, and much more to changes in the maximum electron density itself and to low-/mid-latitude ionospheric currents. Changes in the magnetic field even contribute to cooling of the thermosphere at ~300 km altitude, although the increase in CO2 concentration is still the dominant factor here. Both processes are roughly equally important for long-term changes in ion temperature.