The key process of solar cell is that electrons and holes are generate in the structure, and then they separated by the p-n junction field in such a way that electrons go to n-side, while holes go to p-side. Eventually, they provide current to extern circuit (load). However, minority carriers may diffuse to the opposite contact and recombine there, contributing to losses. For simplicity, let us consider single cell. If electron is generated inside p-side, than diffuse to the depletion region near the p-n junction, feels the p-n junction field, and goes to n-side - it is OK. But electron generated in the p-side may also diffuse in opposite direction, reach the p-metal contact and recombine where - in this case it is lost. To prevent it, one can insert a thin p-layer with a wider energy gap between p-side and p-metal. P-doping will make the valence band more or less smooth, while most of the difference in the energy gap will be accumulated in the conduction band. So, a potential barrier will be formed for electrons preventing their recombination at the p-metal contact surface.
Please find attached a couple of pictures illustrating effect of the top BSF layer in the example.
Next, let us consider what happens when we change the doping level from 2e18 to 2e16. The Fermi level position will be changed, but very slightly. namely, the difference between the Fp and Ev becomes higher, and so the difference between the Fp and Ec becomes lower. So, the potential barrier for electrons becomes slightly lower, and eventually the open-circuit voltage is slightly changed. But the overall effect is rather small, because the barrier for electrons created by BSF is anyway high.