Compared with three-dimensional (3D) perovskites, two-dimensional (2D) perovskites have excellent environmental stability. However, the efficiency of 2D perovskite solar cells is still lower than that of their 3D counterparts owing to the poor carrier transport. In order to improve the efficiency of 2D perovskite solar cells, the cesium (Cs) doping 2D (CMA)<sub>2</sub>MA<sub>8</sub>Pb<sub>9</sub>I<sub>28</sub> films with an inverse gradient structure (small <i>n</i> quantum well (QW) located at the surface and large <i>n</i> QW at the bottom) are prepared. The inverse gradient QW structure has the advantages of being more moisture-resistant (small <i>n</i> QW protects the vulnerable large <i>n</i> QW from being attacked by water molecules) and favoring self-driven charge transport (type-II band alignment between different phases). The results show that the quality and thermal stability of 2D (CMA)<sub>2</sub>MA<sub>8</sub>Pb<sub>9</sub>I<sub>28</sub> film can be effectively improved by using Cs doping. The SEM images show that the film grains become larger, and the surface is smoother and more compact with CsI content increasing. When CsI increases to 15%, the surface becomes coarse. From the XRD, it can be seen that the crystallinity of perovskite is improved with CsI doping, and it reaches saturation when CsI content increases to 10%. The PL intensity of the film with 5% CsI is higher than the others’, implying a relatively low non-radiative recombination loss and low defect state in that film. Therefore, the minority carrier average lifetime of film doped with 5% CsI is the longest. The absorption is almost unchanged when CsI is doped. The thermal stability of film can be effectively improved when CsI exceeds 10%. Considering the SEM images, crystallinity, PL intensity, light absorption and thermal stability of perovskite, the optimized CsI doped concentration is 10% in our work. Finally, the highest efficiency of (CMA)<sub>2</sub>MA<sub>8</sub>Pb<sub>9</sub>I<sub>28</sub> perovskite solar cells doped with 10% CsI content reaches to 14.67%, with a short-circuit current density (<i>J</i><sub>SC</sub>) of 23.16 mA/cm<sup>2</sup>, an open-circuit voltage (<i>V</i><sub>oc</sub>) of 1.05 V and a fill factor (FF) of 60.75%. The efficiency of the undoped cells is 10.06%, which is lower than that of CsI doped cells (10%). Therefore, CsI doping is an effective method to further improve the efficiency and thermal stability of 2D perovskite solar cells.