There are two causes of charge carrier motion and separation in a solar cell:
#drift of carriers, driven by the electric field, with electrons being pushed one way and holes the other way
#diffusion of carriers from zones of higher carrier concentration to zones of lower carrier concentration (following a gradient of chemical potential).
These two "forces" may work one against the other at any given point in the cell. For instance, an electron moving through the junction from the p region to the n region (as in the diagram at the beginning of this article) is being pushed by the electric field against the concentration gradient. The same goes for a hole moving in the opposite direction.
It is easiest to understand how a current is generated when considering electron-hole pairs that are created in the depletion zone, which is where there is a strong electric field. The electron is pushed by this field toward the n side and the hole toward the p side. (This is opposite to the direction of current in a forward-biased diode, such as a light-emitting diode in operation.) When the pair is created outside the space charge zone, where the electric field is smaller, diffusion also acts to move the carriers, but the junction still plays a role by sweeping any electrons that reach it from the p side to the n side, and by sweeping any holes that reach it from the n side to the p side, thereby creating a concentration gradient outside the space charge zone.
In thick solar cells there is very little electric field in the active region outside the space charge zone, so the dominant mode of charge carrier separation is diffusion. In these cells the diffusion length of minority carriers (the length that photo-generated carriers can travel before they recombine) must be large compared to the cell thickness.  In thin film cells (such as amorphous silicon), the diffusion length of minority carriers is usually very short due to the existence of defects, and the dominant charge separation is therefore drift, driven by the electrostatic field of the junction, which extends to the whole thickness of the cell.
Once the minority carrier enters the drift region, it is swept across the junction and, at the other side of the junction, becomes a majority carrier. This reverse current is a generation current, fed both thermally and (if present) by the absorption of light. On the other hand, majority carriers are driven into the drift region by diffusion (resulting from the concentration gradient), which leads to the forward current; only the majority carriers with the highest energies (in the so-called Boltzmann tail; cf. Maxwell–Boltzmann statistics) can fully cross the drift region. Therefore, the carrier distribution in the whole device is governed by a dynamic equilibrium between reverse current and forward current.