Aims. The main goal of this paper is to derive observational constraints on the halo mass fuction (HMF) by performing a tomographic analysis of the magnification bias signal on a sample of background submillimeter galaxies. The results can then be compared with those from a non-tomographic study. Methods. We measure the cross-correlation function between a sample of foreground GAMA galaxies with spectroscopic redshifts in the range 0.1 < z < 0.8 (and divided up into four bins) and a sample of background submillimeter galaxies from H-ATLAS with photometric redshifts in the range 1.2 < z < 4.0. We model the weak lensing signal within the halo model formalism and carry out a Markov chain Monte Carlo algorithm to obtain the posterior distribution of all HMF parameters, which we assume to follow the Sheth and Tormen (ST) three-parameter and two-parameter fits. Results. While the observational constraints on the HMF from the non-tomographic analysis are not stringent, there is a remarkable improvement in terms of uncertainty reduction when tomography is adopted. Moreover, with respect to the traditional ST triple of values from numerical simulations, the results from the three-parameter fit predict a higher number density of halos at masses below ∼ 10 12 M /h at 95% credibility. The two-parameter fit yields even more restricting results, with a larger number density of halos below ∼ 10 13 M /h and a lower one above ∼ 10 14 M /h, this time at more than 3σ credibility. Our results are therefore in disagreement with the standard N-body values for the ST fit at 2σ and 3σ, respectively.