  Cosmological perturbations of sufficiently long wavelength admit a fluid
dynamic description. We consider modes with wavevectors below a scale $k_m$ for
which the dynamics is only mildly non-linear. The leading effect of modes above
that scale can be accounted for by effective non-equilibrium viscosity and
pressure terms. For mildly non-linear scales, these mainly arise from momentum
transport within the ideal and cold but inhomogeneous fluid, while momentum
transport due to more microscopic degrees of freedom is suppressed. As a
consequence, concrete expressions with no free parameters, except the matching
scale $k_m$, can be derived from matching evolution equations to standard
cosmological perturbation theory. Two-loop calculations of the matter power
spectrum in the viscous theory lead to excellent agreement with $N$-body
simulations up to scales $k=0.2 \, h/$Mpc. The convergence properties in the
ultraviolet are better than for standard perturbation theory and the results
are robust with respect to variations of the matching scale.
