Galls function as provide shelter for gall inducers, guarding them against their natural enemies. Previous research has illuminated the interactions between galls, gall inducers, and their corresponding parasitoids within various caltrop plants. However, less is known about these relationships within Nitraria sibirica, particularly regarding the efficacy of parasitism. Therefore, this study aimed to identify the morphometric relationships among the swollen galls, gall inducers, and their parasitoids. Two species of gall inducers and three species of parasitoids were obtained from the swollen galls of N. sibirica. The correlations of the parasitization indexes, the lifespan of gall inhabitants, and temperature and the morphometric relationships between the galls and their inhabitants were analyzed. The dominant gall inducer identified was Contarinia sp. (Diptera: Cecidomyiidae). Furthermore, it was observed that three solitary parasitoids attacked Contarinia sp. in the swollen galls, with only Eupelmus gelechiphagus acting as an idiobiont ectoparasitoid. The dominant parasitoids were Platygaster sp. and Cheiloneurus elegans at sites 1 and 2, respectively, with Platygaster sp. displaying greater abundance than C. elegans in the swollen galls. The lifespan of the gall inhabitants shortened gradually as the temperature increased. Moreover, the optimal number of gall chambers ranged from two to four per swollen gall with maximized fitness, which can be considered the optimal population density for the gall inducer Contarinia sp. Morphometric analysis exhibited a strong linear correlation between gall size and chamber number or the number of gall inhabitants, as well as a weak correlation between gall size and body size of the primary inhabitants of swollen galls. Our results highlight the importance of the biological investigation of parasitoids and gall inducers living in closed galls with multiple chambers and may pave the way for potential application in biological control.