In some reservoirs, groundwater or formation water is exposed to high salinity salt solution and high underground temperature conditions. In high salinity environments,traditional fracturing fluid are prone to salt crystallization, salt deposition and colloidal particle aggregation.Moreover, In high temperature environment, additives and colloids in traditional fracturing fluids may degrade, fail or denature, resulting in the degradation of the fracturing fluid performance. Most of the fracturing fluids studied to date cannot meet the performance requirements of temperature and salt resistance simultaneously while ensuring a low cost.To solve this problem,using acrylamide (AM), acrylic acid (AA), 2-acrylamido-2-methylpropanesulfonic acid (AMPS), and the hydrophobic monomer allyl polyethylene glycol (APEG) as molecular skeletons, an associating viscoelastic polymer, p(AM/AA/AMPS/APEG), was prepared via inverse emulsion polymerization. The structure and morphology of the polymer were characterized via Fourier transform infrared spectroscopy, 1H nuclear magnetic resonance spectroscopy, scanning electron microscopy, and laser particle size analysis, and its rheological properties, particularly thixotropy and viscoelasticity, were evaluated. The p(AM/AA/AMPS/APEG) solution showed the characteristics of a viscoelastic fluid, as well as good temperature resistance at 160°C and a concentration of 0.8 wt.%. The viscosity of p(AM/AA/AMPS/APEG) was 64.88 and 56.77 mPa·s after shearing in 20000 mg/L NaCl solution and CaCl2 solution for 1 h at 140°C and 170 s− 1, respectively. With increasing polymer concentration, the intermolecular association efficiency of the hydrophobic groups and the apparent viscosity of the solution increased. The p(AM/AA/AMPS/APEG) polymer exhibited good thixotropy, salt resistance, temperature resistance, and shear resistance. This hydrophobically associating polymer shows good application prospects in the development and utilization of unconventional oil and gas resources.