CsPbX3 (X = Br, Cl, I) perovskite quantum dots (PQDs) are the rising star for various display applications owing to their excellent opto-electrical properties, such as an adjustable spectrum, narrow emission linewidth and high quantum yield. However, these PQDs are well known to suffer from intrinsic instability under atmospheric conditions. In this work, a novel photosensitive ligand, phenylbis(2,4,6-trimethylbenzoyl)phosphine oxide (XBPO), was employed as a dual-functional reagent for PQD surface engineering. The XBPO ligand could cleave to produce phenylphosphinyl radicals and trimethylbenzoyl radicals under UV light irradiation. The phenylphosphinyl radicals with PO bonds could effectively passivate the PQD surface defects, leading to quantum yield improvement. The CsPbBr3 and CsPbI3 PQDs with XBPO modification could achieve a photoluminescence quantum yield (PLQY) of near unity and 92%, respectively. Additionally, the in situ encapsulation of the PQDs was achieved by the subsequent crosslinking polymerization, which significantly improved the stability of the PQDs against solvents and the environment. By combining a standard photolithography procedure, we demonstrated a micro-pattern of CsPbBr3 PQDs. These results establish a universal route for PQD patterning, compatible with the existing photolithography processes, which could facilitate the application of PQDs in next-generation display technology.