Quasi-2D Ruddlesden–Popper perovskites have been widely used in the photoelectric detection field owing to their tunable optical bandgap and superior stability. However, because phases formed in the quasi-2D perovskite films have unfixed n values, the transport channels of charge carriers are greatly disordered. Herein, based on the hot-casting method, the effects of substrate temperature on the surface morphology and internal phases distribution of 2D perovskite films was investigated, leading to the preparation of uniform and compact 2D–3D gradient perovskite thin films. Perovskites have an orderly gradient phase distribution along the longitudinal direction of the thin film, which is beneficial to the separation and transport of carriers, thus improving the photosensitivity of photodiode over the whole visible spectrum range. The ideal photodetector fabricated at 120 ℃ has an extremely low dark current density (2.3 × 10−11A/cm2), large specific detectivity (1.22 × 1014 Jones) at 455 nm, ultra-fast response time (5.5/4.7 µs) and ultra-high on/off ratio of 108, indicating its great potential for high-efficiency photodetection without the voltage bias (0 V). Moreover, compared with 3D perovskite devices, hot-casted 2D perovskite devices exhibit greatly improved stability, with JD remaining at about 10−11A/cm2 for 400 h, which is very significant for realizing outstanding performance and stable photodiodes.