Concepts of immiscible displacements in porous media driven by mass transfer are utilized to model drying of porous media. Visualization experiments of drying in two-dimensional glass micromodels are conducted to identify pore-scale mechanisms. Then, a pore network approach is used to analyze the advancing drying front. It is shown that in a porous medium, capillarity induces a flow that effectively limits the extent of the front, which would otherwise be of the percolation type, to a finite width. In conjuction with the predictions of a macroscale stable front, obtained from a linear stability analysis, the process is shown to be equivalent to invasion percolation in a stabilizing gradient. A power-law scaling relation of the front width with a diffusion-based capillary number is also obtained. This capillary number reflects the fact that drying is controlled by diffusion in contrast to external drainage. The scaling exponent predicted is compatible with the experimental results of Shaw [Phys Rev. Lett. {bold 59}, 1671 (1987)]. A framework for a continuum description of the upstream drying regimes is also developed. {copyright} {ital 1999} {ital The American Physical Society}