Temperature and pressure variations in compressed air energy storage (CAES) caverns are important factors that affect the overall performance of CAES systems. However, current air storage cavern models used in the thermodynamic analysis of CAES systems usually ignore the effect of heat exchange between cavern air and the surrounding environment and thus cannot accurately predict temperature and pressure variations. In this study, a diabatic analytical solution in a simple and unified form and that considers heat exchange is proposed for temperature and pressure variations in CAES caverns. The solution is derived on the basis of assumptions that the air density in the cavern can be represented by a constant average value and that the cavern wall temperature remains constant. The proposed solution is validated with the test data of the Huntorf plant trial test and the results calculated with other solutions. Moreover, the errors of the proposed solution caused by the assumptions are analyzed. Results show that in representative ranges, the errors have a significant positive correlation with the ratio of the injected to the initial cavern air mass and the difference between the injected air temperature and the initial air temperature. The errors also have an insignificant negative correlation with the rock thermal effusivity and the heat transfer coefficient. Finally, the condition under which the proposed solution is applicable with an error less than 20% is defined on the basis of the combination of the ratio of the injected to the initial cavern air mass and the difference between the injected air temperature and the initial air temperature. This simplified and unified solution can be a simple yet adequately accurate tool to be used in the thermodynamic analysis of CAES systems.