This study aims to improve the performance of barium stannate (PBS) based photoanode by co-doping with rare earth elements (Y3+ and La3+) and optimizing charge transport in the mesoporous TiO2 (meso-TiO2) as compact layer at the FTO interface. Employing Y3+ and La3+ dopant into BaSnO3 (YLB) at the FTO/meso-TiO2/YLB interface enhances light absorption and minimizes charge recombination. The resulting DSSC device, utilizing a meso-TiO2/YLB3 photoanode (PBS-3% of Y3+/La3+), achieves an efficiency of 3.79 %, with a high current density of 8.04 mA/cm2, a fill factor of 64.76 % and an open circuit voltage of 0.73 V. The synergistic effect of dopant and compact layer treatment purposefully improves photon and charge collection, enhancing overall device performance and reducing recombination at the interface. Consequently, the introduction of a compact layer-treated co-doped PBS photoanode emerges as a promising alternative for a charge transport layer in DSSC.