We report a formula for the dry adiabatic lapse rate that depends on the compressibility factor and the adiabatic curves. Then, to take into account the nonideal behavior of the gases, we consider molecules that can move, rotate, and vibrate and the information of molecular interactions through the virial coefficients. We deduce the compressibility factor in its virial expansion form and the adiabatic curves within the virial expansion up to any order. With this information and to illustrate the mentioned formula, we write the lapse rate for the ideal gas, and the virial expansion up to the second and third coefficient cases. To figure out the role of the virial coefficients and vibrations, under different atmospheric conditions, we calculate the lapse rate for Earth, Mars, Venus, Titan, and the exoplanet Gl 581d. Furthermore, for each one we consider three models in the virial expansion: van der Waals, square-well, and hard-sphere. Also, when possible, we compare our results to the experimental data. Finally, we remark that for Venus and Titan, which are under extreme conditions of pressure or temperature, our calculations are in good agreement with the observed values, in some instances.