[Abridged] We present a physical model for the evolution of the ultraviolet (UV) luminosity function (LF) of high-z galaxies taking into account in a self-consistent way their chemical evolution and the associated evolution of dust extinction. The model yields good fits of the UV and Lyman-alpha LFs at z>~2. The weak evolution of both LFs between z=2 and z=6 is explained as the combined effect of the negative evolution of the halo mass function, of the increase with redshift of the star formation efficiency, and of dust extinction. The slope of the faint end of the UV LF is found to steepen with increasing redshift, implying that low luminosity galaxies increasingly dominate the contribution to the UV background at higher and higher redshifts. The observed range of UV luminosities at high-z implies a minimum halo mass capable of hosting active star formation M_crit <~ 10^9.8 M_odot, consistent with the constraints from hydrodynamical simulations. From fits of Lyman-alpha LFs plus data on the luminosity dependence of extinction and from the measured ratios of non-ionizing UV to Lyman-continuum flux density for samples of z=~3 Lyman break galaxies and Lyman-alpha emitters, we derive a simple relationship between the escape fraction of ionizing photons and the star formation rate, impling larger escape fraction for less massive galaxies. Galaxies already represented in the UV LF (M_UV <~ -18) can keep the universe fully ionized up to z=~6, consistent with (uncertain) data pointing to a rapid drop of the ionization degree above z~6. On the other side, the electron scattering optical depth, tau_es, inferred from CMB experiments favor an ionization degree close to unity up to z=~9-10. Consistency with CMB data can be achieved if M_crit =~ 10^8.5 M_odot, implying that the UV LFs extend to M_UV =~ -13, although the corresponding tau_es is still on the low side of CMB-based estimates.