We combine spatially resolved ASCA temperature data with ROSAT imaging data to constrain the total mass distribution in the cluster A401, assuming that the cluster is in hydrostatic equilibrium. We obtain a total mass within the X-ray core (290/h_50 kpc) of 1.2[+0.1,-0.5] 10^14 /h_50 Msun at the 90% confidence level, 1.3 times larger than the isothermal estimate. The total mass within r_500 (1.7/h_50 Mpc) is M_500 = 0.9[+0.3,-0.2] 10^15/ h_50 Msun at 90% confidence, in agreement with the optical virial mass estimate, and 1.2 times smaller than the isothermal estimate. Our M_500 value is 1.7 times smaller than that estimated using the mass-temperature scaling law predicted by simulations. The best fit dark matter density profile scales as r^{-3.1} at large radii, which is consistent with the Navarro, Frenk & White (NFW) ``universal profile as well as the King profile of the galaxy density in A401. From the imaging data, the gas density profile is shallower than the dark matter profile, scaling as r^{-2.1} at large radii, leading to a monotonically increasing gas mass fraction with radius. Within r_500 the gas mass fraction reaches a value of f_gas = 0.21[+0.06,-0.05] h_50^{-3/2} (90% confidence errors). Assuming that f_gas (plus an estimate of the stellar mass) is the universal value of the baryon fraction, we estimate the 90% confidence upper limit of the cosmological matter density to be Omega_m < 0.31.