We report a systematic density functional theory (DFT) computational investigation of Ru(II) sensitizer/TiO2 systems relevant to dye-sensitized solar cells (DSSCs). Focusing on the prototypical N719 and the recently introduced YE05 sensitizers, and considering large slab and cluster models for TiO2, we have systematically studied the influence of the molecular adsorption geometry, counterions, and surface protonation on the electronic structure of the dye/semiconductor systems by means of Car-Parrinello molecular dynamics combined with single-point hybrid functional calculations of the electronic properties. Our results show that the homoleptic N719 and YE05 dyes. both bearing two bipyridine ligands functionalized with four carboxylic groups, adsorb onto the TiO2 surface by exploiting three carboxylic groups. The bulky TBA counterions employed in N719 cause a modest energy down-shift of the TiO2 conduction band, whereas the smaller Na+ counterions, which can access the surface more closely, lead to a larger conduction hand energy perturbation. Our results also confirm that the surface protonation plays a fundamental role in determining the DSSC efficiency, with a strong impact on both short-circuit photocurrent and open-circuit potential. Altogether, our study provides evidence that adsorption of the sensitizer via "three anchoring sites" is a key requisite to obtain high open-circuit potentials when employed in DSSC devices, thus paving the route to the design of new and more efficient sensitizers.