Optimizing agricultural resources such as fertilizer level and plant density is important to reconcile economic and environmental goals in sustainable agriculture. Therefore, the aim of this study was to optimize the levels of nitrogen (N), phosphorus (P), potassium (K), and plant spacing (PS) in order to maximize yield traits and N use efficiency (NUE) of sunflower. The experiment was conducted through response surface methodology (RSM) in a Box-Behnken design with four factors of N (0, 80, and 160 kg ha −1 ), P (0, 15.4, and 30.8 kg ha −1 ), K (0, 20.75, and 41.5 kg ha −1 ), and PS (15, 25, and 35 cm). The seed yield was improved with increasing N and P levels and decreasing PS. The response of seed oil content to each of the N and P factors depended on the rate of the other factors. PS had a quadratic effect on oil content. The NUE decreased by increasing N rate and PS, while P application positively affected NUE. The K fertilization had no effect on seed oil production and NUE. The optimized levels of factors to obtain desirable values of responses were 62.3, 30.8, and 41.5 kg ha −1 of N, P, and K respectively and PS of 15 cm, resulting in 3797 kg ha −1 of seed yield and 24.8 kg kg −1 of NUE. Optimization indicated that through denseplanting and meeting the sunflower need for P and K, the application rate of N can be remarkably reduced along with obtaining an acceptable seed yield.