The goal of this work is to optimize the deposition mass distribution of polydisperse particles inside the fibrous media by modifying the distribution of the fiber packing density across filter depth. Two types of gradient fibrous media with linear and exponential fiber packing density distribution along the flow direction were derived. The method of moments was employed to study the transport and deposition characteristics of polydisperse aerosol particles inside the fibrous media. The reliability of the calculated results by the method of moments was confirmed by the numerical simulations based on the discrete phase model (DPM). Results indicate that the gradient fibrous media allows more particles to transport and deposit into the interior of the fibrous media, which improves the uniformity of particle deposition distribution across filter depth. There exists an optimal fiber packing density distribution ratio for the gradient fibrous media where the non-uniformity of deposition mass distribution of polydisperse particles across filter depth is minimized. In this way, uniform deposition distribution along the flow direction can be generally achieved by optimizing the fiber packing density distribution, which will contribute to the optimal design of microstructures for the fibrous filter.