Planting density affects crop microclimate and intra-plant competition, playing an important role on yield formation and resource use, especially in areas where the cotton is grown at relatively high plant densities in Xinjiang, China. However, more studies are needed to examine how the change in planting density affects the microclimate factors such as the fraction of light intercepted (FLI), air temperature(T) and relative humidity (RH) within different canopy layers, which in turn affect the boll number per plant (BNF), boll number per unit area (BNA), boll weight (BW), and boll-setting rate (BSR) at fruiting branch (FB) positions FB1–3, FB4–6, and FB≥7 in cotton. To quantify the relationships between boll characteristics, yield, and microclimate factors, we conducted a 2-year field experiment in 2019–2020 in Xinjiang with six plant densities: 9 (P1), 12 (P2), 15 (P3), 18 (P4), 21 (P5), and 24 (P6) plants m−2. With each three plants m−2 increase in density, the average FLI and RH across different canopy layers increased by 0.37 and 2.04%, respectively, whereas T decreased by 0.64 °C. The BNF at FB≥ 7, FB4–6, and FB1–3 decreased by 0.82, 0.33, and 0.5, respectively. The highest BNA was observed in the upper and middle layers in the P4 treatment and in the lowest canopy layer with the P5. The highest BW was measured in the middle canopy layer for P3, and the highest BSR was measured in the lower layer for P3. Plant density exhibited linear or quadratic relationships with FLI, T, and RH. Microclimate factors mainly affected the boll number in each layer, but had no significant effects on the BW in any layer or the BSR in the middle and lower layers. Cotton yield was non-linearly related to plant density. The 2-year maximum yield was achieved at a plant density of 21 plants m−2, but the yield increase compared to the yield with a density of 18 plants m−2was only 0.28%. Thus, we suggest that the optimal plant density for drip-irrigated cotton in Xinjiang is 18 plants m−2, which could help farmers grow machine-harvested cotton.