Industrialization and agricultural demand have both improved human life and led to environmental contamination. Especially thedischarge of a lot of poisonous and harmful gases, including ammonia, ammonia pollution has become a pressing problem. High concentrations of ammonia can pose significant threats to both the environment and human health. Therefore, accurate monitoring and detection of ammonia gas are crucial. To address this challenge, we have developed an ammonia gas sensor using In(OH)3/Ti3C2Tx nanocomposites through an in-situ electrostatic self-assembly process. This sensor was thoroughly characterized using advanced techniques like XRD, XPS, BET, and TEM. In our tests, the I/M-2 sensor exhibited remarkable performance, achieving a 16.8% response to 100ppm NH3 at room temperature, which is a 3.5-fold improvement over the pure Ti3C2Tx MXene sensor. Moreover, it providesswift response time (20s), high response to low NH3concentrations (≤ 10ppm), and excellent long-term stability (30days). These exceptional characteristics indicate the immense potential of our In(OH)3/Ti3C2Tx gas sensor in ammonia detection.