  In order to use strong gravitational lens time delays to measure precise and
accurate cosmological parameters the effects of mass along the line of sight
must be taken into account. We present a method to achieve this by constraining
the probability distribution function of the effective line of sight
convergence k_ext. The method is based on matching the observed overdensity in
the weighted number of galaxies to that found in mock catalogs with k_ext
obtained by ray-tracing through structure formation simulations. We explore
weighting schemes based on projected distance, mass, luminosity, and redshift.
This additional information reduces the uncertainty of k_ext from sigma_k $0.06
to ~0.04 for very overdense lines of sight like that of the system B1608+656.
For more common lines of sight, sigma_k is reduced to ~<0.03, corresponding to
an uncertainty of ~<3% on distance. This uncertainty has comparable effects on
cosmological parameters to that arising from the mass model of the deflector
and its immediate environment. Photometric redshifts based on g, r, i and K
photometries are sufficient to constrain k_ext almost as well as with
spectroscopic redshifts. As an illustration, we apply our method to the system
B1608+656. Our most reliable k_ext estimator gives sigma_k=0.047 down from
0.065 using only galaxy counts. Although deeper multi-band observations of the
field of B1608+656 are necessary to obtain a more precise estimate, we conclude
that griK photometry, in addition to spectroscopy to characterize the immediate
environment, is an effective way to increase the precision of time-delay
cosmography.

Cosmology and Nongalactic Astrophysics