Planetary upper atmospheres -coexisting thermospheres and ionospheres -form an important boundary between the planet itself and interplanetary space. The solar wind and radiation from the Sun may react with the upper atmosphere directly, as in the case of Venus. If the planet has a magnetic field, however, such interactions are mediated by the magnetosphere, as in the case of the Earth. All of the Solar System's giant planets have magnetic fields of various strengths, and interactions with their space environments are thus mediated by their respective magnetospheres. This article concentrates on the consequences of magnetosphere-atmosphere interactions for the physical conditions of the thermosphere and ionosphere. In particular, we wish to highlight important new considerations concerning the energy balance in the upper atmosphere of Jupiter and Saturn, and the role that coupling between the ionosphere and thermosphere may play in establishing and regulating energy flows and temperatures there. This article also compares the auroral activity of Earth, Jupiter, Saturn and Uranus. The Earth's behaviour is controlled, externally, by the solar wind. But Jupiter's is determined by the co-rotation or otherwise of the equatorial plasmasheet, which is internal to the planet's magnetosphere. Despite being rapid rotators, like Jupiter, Saturn and Uranus appear to have auroral emissions that are mainly under solar (wind) control. For Jupiter and Saturn, it is shown that Joule heating and "frictional" effects, due to ion-neutral coupling can produce large amounts of energy that may account for their high exospheric temperatures.