Summary High-temperature stability of spacer fluid is a vital prerequisite to ensure the safety of cementing operations in deep or ultradeep wells. Faced with this problem, the thermal stability of the suspension agent in the spacer fluid at high temperatures is improved from the aspects of polymerization monomer and molecular chain. A terpolymer SAD was synthesized by free radical polymerization of sodium styrene sulfonate (SSS), acrylamide (AM), and N, N’-diethylacrylamide (DEAA) in aqueous solution. The name of the terpolymer, SAD, is the initial letter composition of the three polymerization monomers. Polyethyleneimine (PEI) can improve the molecular chain structure of SAD by transamidation reaction with the amide group in SAD, so a high temperature suspension agent PSAD (polyethyleneimine + SAD) was obtained by compounding PEI with SAD. The structure and properties of PSAD were characterized by Fourier infrared spectroscopy, hydrogen nuclear magnetic resonance (NMR) spectroscopy, gel permeation chromatography, X-ray photoelectron spectroscopy (XPS), thermogravimetric analysis, scanning electron microscopy (SEM), and viscosity test. In addition, the comprehensive properties of the spacer fluid under the action of PSAD are evaluated. The results showed that the crosslinking degree of PSAD gradually increased with the increase in temperature. After aging at 200°C, the decomposition temperature of PSAD was 305°C, which show terrific thermal stability. At the same time, the spacer fluid prepared by PSAD not only has excellent rheological properties in the range of 90 ~ 200°C but also keeps the density difference between the upper and lower parts of the slurry less than 0.02 g/cm3 and the filtration loss of the slurry less than 50 mL.