Colloidal quantum dots (CQDs) are promising photovoltaic (PV) materials because of their widely tunable absorption spectrum controlled by nanocrystal size1,2. Their bandgap tunability allows not only the optimization of single-junction cells, but also the fabrication of multijunction cells that complement perovskites and silicon 3 . Advances in surface passivation2,4-7, combined with advances in device structures 8 , have contributed to certified power conversion efficiencies (PCEs) that rose to 11% in 2016 9 . Further gains in performance are available if the thickness of the devices can be increased to maximize the light harvesting at a high fill factor (FF). However, at present the active layer thickness is limited to ~300 nm by the concomitant photocarrier diffusion length. To date, CQD devices thicker than this typically exhibit decreases in short-circuit current (JSC) and open-circuit voltage (VOC), as seen in previous reports3,9-11. Here, we report a matrix engineering strategy for CQD solids that significantly enhances the photocarrier diffusion length. We find that a hybrid inorganic-amine coordinating complex enables us to generate a high-quality two-dimensionally (2D) confined inorganic matrix that programmes internanoparticle spacing at the atomic scale. This strategy enables the reduction of structural and energetic disorder in the solid and concurrent improvements in the CQD packing density and uniformity. Consequently, planar devices with a nearly doubled active layer thicknesses (~600 nm) and record values of JSC (32 mA cm-2) are fabricated. The VOC improved as the current was increased. We demonstrate CQD solar cells with a certified record efficiency of 12%.