The harmful effects of improper sewage sludge (SS) treatment on the environment inspire the search for more benign sludge processing techniques such as hydrothermal carbonization (HTC); the abundant organic matter in SS is used for energy recovery. Here, we aimed to optimize the HTC-based preparation of SS hydrochar and its gasification performance by using response surface methodology (RSM). Specifically, the hydrochar yield, higher heating value (HHV), and gasification activity index were selected as optimization goals, whereas carbonization temperature (160-260 degrees C), residence time (30-150 min), and acetic acid concentration (0-1.5 M) were selected as factors influencing the HTC process and CO2-assisted gasification performance. Carbonization temperature was the dominant parameter determining hydrochar yield, HHV, and gasification activity. The hydrochar yield (82.69%) and calorific value (7820.99 kJ kg(-1)) were maximized under comparatively mild conditions (160 degrees C, 30 min, and 0.07 M acetic acid), whereas the gasification activity index (0.288 s(-1)) was maximized under harsher conditions (211.34 degrees C, 88.16 min, and 1.58 M acetic acid). The results help to guide the HTC of SS intended for gasification, thus promoting the development of this promising waste-to-energy technology and may facilitate the design and further optimization of thermochemical SS conversion.