The past several years have witnessed the rapid emergence of a class of solar cells based on mixed organic-inorganic halide perovskites. Today's state-of-the-art perovskite solar cells (PSCs) employ various methods to enhance nucleation and improve the smoothness of the perovskite films formed via solution processing. However, the lack of precise control over the crystallization process creates a risk of forming unwanted defects, for example, pinholes and grain boundaries. Here, we introduce an approach to prepare perovskite films of high electronic quality by using poly(methyl methacrylate) (PMMA) as a template to control nucleation and crystal growth. We obtain shiny smooth perovskite films of excellent electronic quality, as manifested by a remarkably long photoluminescence lifetime. We realize stable PSCs with excellent reproducibility showing a power conversion efficiency (PCE) of up to 21.6% and a certified PCE of 21.02% under standard AM 1.5G reporting conditions.