We present the results of the analysis of gamma-ray and X-ray data of GRB 050401 taken with the Swift satellite, together with a series of ground-based follow-up observations. The Swift X-ray light curve shows a clear break at about 4900 seconds after the GRB. The decay indices before and after the break are consistent with a scenario of continuous injection of radiation from the central engine of the GRB to the fireball. Alternatively, this behaviour could result if ejecta are released with a range of Lorentz factors with the slower shells catching up the faster at the afterglow shock position. The two scenarios are observationally indistinguishable. The GRB 050401 afterglow is quite bright in the X-ray band but weak in the optical, with an optical to X-ray flux ratio similar to those of dark bursts. We detect a significant amount of absorption in the X-ray spectrum, with N_H = (1.7 +/- 0.2) x 10^22 cm^-2 at a redshift of z=2.9, which is typical of a dense circumbust medium. Such high column density implies an unrealistic optical extinction of 30 magnitudes if we adopt the Galactic extinction law, which would not consistent with optical detection of the afterglow. This suggests that the extinction law is different from the Galactic one.