Straw returning has been widely used as a nitrogen (N) reduction measure in the North China Plain in recent years. However, little is known of the optimal planting density and N application rate of cotton under straw returning. In order to study the effect of the planting density and N application rate on cotton yield, nitrogen agronomic efficiency (NAE), fertilizer N recovery efficiency (FNRE), N balance and soil N under straw returning, a split-plot design in randomized complete blocks was used in the experiment. The main plots were assigned to plant densities (4.50 × 104, 6.75 × 104 and 9.00 × 104 plants hm−2), and the subplots to N application rates (0, 180, 225 and 270 kg N hm−2). The results showed that the biological yield increased as the planting density and the N application rate increase, but the harvest index decreased. Therefore, the highest biological yield was found under D9.00N270, but the highest cotton yield was found under D6.75N225. Excessive N (N270) application rate was not conducive to the improvement of NAE and FNRE. The amounts of plant N derived from fertilizer (Ndff) was reduced with the increase of planting density. Therefore, soil N would be consumed because the N balance was a negative value when N application rate was decreased at N180, especially at high density. The N balance was closest to zero at D6.75N225. In summary, with the yield, NAE, FNRE, N balance and the stability of soil N taken into consideration, the optimal combination of planting density and N application rate in the North China Plain was D6.75N225, because this treatment had the highest cotton yield, and most importantly, it maintained sustainable cotton production in the field.