We use dust masses ($M_{dust}$) derived from far-infrared data and molecular gas masses ($M_{mol}$) based on CO luminosity, to calibrate proxies based on a combination of the galaxy Balmer decrement, disk inclination and gas metallicity. We use such proxies to estimate $M_{dust}$ and $M_{mol}$ in the local SDSS sample of star-forming galaxies (SFGs). We study the distribution of $M_{dust}$ and $M_{mol}$ along and across the Main Sequence (MS) of SFGs. We find that $M_{dust}$ and $M_{mol}$ increase rapidly along the MS with increasing stellar mass ($M_*$), and more marginally across the MS with increasing SFR (or distance from the relation). The dependence on $M_*$ is sub-linear for both $M_{dust}$ and $M_{mol}$. Thus, the fraction of dust ($f_{dust}$) and molecular gas mass ($f_{mol}$) decreases monotonically towards large $M_*$. The star formation efficiency (SFE, the inverse of the molecular gas depletion time) depends strongly on the distance from the MS and it is constant along the MS. As nearly all galaxies in the sample are central galaxies, we estimate the dependence of $f_{dust}$ and $f_{gas}$ on the host halo mass and find a tight anti-correlation. As the region where the MS is bending is numerically dominated by massive halos, we conclude that the bending of the MS is due to lower availability of molecular gas mass in massive halos rather than a lower efficiency in forming stars.