A series of (n,gamma) neutron capture measurements on the lead isotopes and bismuth have been carried Out at the CERN n_TOF installation in the neutron energy range from 1 eV up to 1 MeV. At n_TOF, contaminations due to scattered neutrons were reduced down to a negligible level by using improved gamma-ray detectors with very low neutron sensitivity. The background level has been determined precisely from a complementary measurement. Other experimental effects related to the electronic threshold in the detectors and the angular distribution of the prompt gamma-rays were investigated via Monte Carlo simulations and could be taken in account in the analysis of the capture data. With this set of measurements the energy differential (n,gamma) cross sections of Pb-204,Pb-206,Pb-207 and Bi-209 have been determined with good accuracy. The information obtained in this work becomes of interest for constraining r-process calculations and in particular for the Th/U cosmochronometer.