I understand that the pressure and density of air increase as the air gets closer to shock waves and the pressure and density of air that has escaped the shock waves increase as well. Then, what happens to the pressure and density of air passing through the shock waves? I guess the density of air would decrease due to the great heat produced by the shock waves (correct me if I'm wrong on this) but what about the pressure? Does it increase because of the heat?
Please rethink your understanding of shocks.
In compression shocks, pressure and density increase suddenly without any change as the air gets closer or flows away from the shock front. All change happens momentarily as the air passes through the shock front. A compression shock is caused by an obstruction to the flow.
Supersonic speed means that the obstruction (a speeding bullet, or an airplane, for example) is moving faster than information about its presence will move through the surrounding air. This information would be a pressure change (like sound waves), but the propagation speed of such sound waves is determined by the physical properties of the medium through which they travel. Only exceptionally violent pressure changes can move faster than this limit - this is why you see first a rapidly expanding ball in movies of nuclear explosions which then abruptly changes to a much more leisurely speed of expansion as the ball grows and the magnitude of the pressure change at its boundary drops. (Note the spikes at the bottom of some of the fireballs in the linked movie: They are caused by the steel beams and tension ropes of the towers on which the bombs were placed. The speed of sound in steel is much higher than in air).
Still from high speed movie of a nuclear explosion (picture source)
The opposite of compression shocks are expansion fans: They let pressure and density drop over a region and are caused by a receding contour of said obstruction. Again, ahead and past the fan region the parameters do not change, but the fan region is protracted the more you move away from the contour change causing it.