We study numerically the viscous phase of horizontal gravity currents of immiscible fluids in the lock-exchange configuration. A numerical technique capable of dealing with stiff density gradients is used, allowing us to mimic high-Schmidt-number situations similar to those encountered in most laboratory experiments. Plane two-dimensional computations with no-slip boundary conditions are run so as to compare numerical predictions with the ‘short reservoir’ solution of Huppert (J. Fluid Mech., vol. 121, 1982, pp. 43–58), which predicts the front position lf to evolve as t1/5, and the ‘long reservoir’ solution of Gratton & Minotti (J. Fluid Mech., vol. 210, 1990, pp. 155–182) which predicts a diffusive evolution of the distance travelled by the front xf ~ t1/2. In line with dimensional arguments, computations indicate that the self-similar power law governing the front position is selected by the flow Reynolds number and the initial volume of the released heavy fluid. We derive and validate a criterion predicting which type of viscous regime immediately succeeds the slumping phase. The computations also reveal that, under certain conditions, two different viscous regimes may appear successively during the life of a given current. Effects of sidewalls are examined through three-dimensional computations and are found to affect the transition time between the slumping phase and the viscous regime. In the various situations we consider, we make use of a force balance to estimate the transition time at which the viscous regime sets in and show that the corresponding prediction compares well with the computational results.