Abstract Since the power conversion efficiencies of organic-inorganic hybrid perovskite solar cells have a rapid development due to their high light absorption coefficient, tunable band gap and low fabrication cost, they have received much attention. The thin film formation and properties have significant effects on the final device performance. While how to control the thin film evolution and introduce film passivation is a critical issue to improve the device efficiency. In this study, we studied the controlled in-situ PbI2 formation during the thin film evolution, and its effect on thin film properties, as well as their passivation effects on the photovoltaic device performance. The final thin film properties are critically related with the precursor used and chlorine inclusion could change the final thin film compositions, and affect the solar cell performance. We further perform a secondary passivation by reacting the excess PbI2 with large organic cation to form 2D perovskite. Based on in-situ PbI2 passivation and secondary 2D perovskite passivation, the devices exhibit a higher PCE of 21.1% and excellent Voc of 1.14 V.