Vast quantities of clathrate hydrate are found in the Arctic and in marine sediments along continental margins. The clathrate structure traps enormous volumes of methane gas, which is both a possible source of global climate change and a potential energy resource. The growth rate and spatial distribution of gas hydrate in the shallow sediments are influenced by a variety of interacting physical processes. In order to quantify these processes, we develop mathematical models for hydrate formation in porous media. An analytical model is derived for the idealized problem of hydrate growth in a porous half‐space which is cooled on its boundary. Our calculations predict the growth rate of a hydrate layer for a given rate of cooling and show that the volume of hydrate is strongly dependent on the two‐phase equilibrium between hydrate and seawater. For a representative phase diagram we find that the volume of hydrate in the layer is less than 1% of the pore volume. Larger volumes of hydrate observed in some locations demand a sustained supply of gas and a long accumulation time. Numerical calculations are used to investigate situations that are more representative of conditions in marine sediments. A simple theoretical expression is derived for the rate of hydrate accumulation due to advection of methane gas from depth. Using typical estimates of fluid velocities in accretionary environments, we obtain an accumulation rate of 1% of the pore volume in 105 years. The predicted vertical distribution of hydrate is consistent with geophysical inferences from observed hydrate occurrences along the Cascadia margin. Similar distributions can arise from the combined effects of in situ methane production and warming due to ongoing sedimentation. Predicted differences between these two formation models may be detectable in geophysical and geochemical measurements.