Methylammonium lead iodide perovskites have limited practical applications due to a lack of stability under operating conditions. Environmental stability under heating has not yet been achieved, although recent studies modifying perovskites with long organic cations have reported the progress of stabilisation under humid conditions. In this work, we report the structural evolution of long alkylammonium-modified MAPbI(3) and its functions for highly efficient and stable solar cells. As an encapsulating agent, octylammonium (OA) cation produced individual MAPbI(3) grains in full armour without the formation of layered structures in contrast to butylammonium (BA) and phenethylammonium (PEA) cations. Our OA-armoured MAPbI(3) achieved a stabilised power conversion efficiency of 20.1% without a deterioration of charge transport properties due to highly preferential orientation suppressing non-radiative recombination. The structural features also led to a much improved thermal stability at 85 degrees C in ambient atmosphere retaining 80% of the initial efficiency after 760 h without any encapsulation, as well as water tolerance. This work addresses widespread concerns associated with the photovoltaic efficiency and stability of MAPbI(3) by exploring the inter-relationship between structural features and their functions in surfactant-modified perovskites.