Grain boundaries (GBs) and grain surfaces (GSs) are the most prominent microstructural features that play significant roles in determining the physical properties and photovoltaic functions of the organic-inorganic halide perovskite (OIHP) thin films. While enormous effort has been devoted to modifying/functionalizing the OIHP GBs and GSs and making them benign, the microstructures in these modified/functionalized OIHP thin films have been somehow random and/or uncertain. Herein, we demonstrate several unique chemical approaches to functionalize the OIHP GBs and GSs confocally at the nanoscale. The key to the unprecedent success of the confocal functionalization is the strong molecular interaction between OIHPs grains and functionalizing agents. Microscopic characterization methods including analytical transmission electron microcopy have been employed to confirm the precisely controlled microstructures in our OIHP thin films. Combined experimental and theoretical studies have showed that the confocal functionalization of OIHP GBs and GSs not only leads to electronic passivation of defects, but also protects OIHP grains from moisture/oxygen ingression and unfavorable phase transformation. As a result, highly efficient and stable perovskite solar cells are demonstrated. The concept of confocal functionalization of the OIHP GBs and GSs is paving the way for developing higher-performance perovskite solar cells of the future.