The mechanical behaviour of porous rocks changes from localised, dilatant shear failure to distributed shear-enhanced compaction with increasing porosity, grain size and effective pressure. Shear-enhanced compaction results in permeability reduction, whereas dilatant shear failure results in permeability enhancement if the host rock porosity is low, but reduces permeability if porosity is high. Hence, focused fluid flow requires dilatant shear failure of low porosity rocks. Changes in porosity and effective pressure with depth in sedimentary basins lead to corresponding variations in failure mode and permeability evolution. This study uses results of deformation experiments to parameterise a constitutive behaviour for sandstones, following the principles of critical state soil mechanics. The constitutive behaviour is implemented in a numerical model that couples deformation with permeability evolution and fluid flow. The model is used to investigate effects of grain size, geothermal gradient and deposition rate, verifying previous predictions regarding the relationship between these parameters and the minimum depth at which focused fluid flow may take place. Fluid diverges out of faults or shear zones at the point where they change from fluid pathways to seals. Dilatant faults formed in extension may undergo compaction and strain hardening during basin inversion.