Oxcides of Nitrogen are produced by high cyl temps, not to be mistaken with high engine temp.

High Cyle temp is created by several factors.
Ping or knock from overadvanced timing, or a knock sensor signal or Bad EGR valve.

Lean A/F mixture, like if you leaned the mixture down to pass the CO portion of the test.
Or a clogged fuel filter forcing a lean mix.

High carbon deposits on valves and pistons.
This will increase compression ratio/cyl temp and even if everything else is perfect IE: timing, mixture, egr, ect...will cause high NOx.
One cure is having a motorvac service at a quality shop.
($150-$300) depending on the shop.
Also...the way I personally recomend...
Only one fuel additive is proven to reduce carbon depostis
"BG44K" at about $20 per can, the price alone indicates you don't want to get this stuff on your clothes or hands.
It does not harm your engine and works in one or two tank fulls. It is a good product to use once or twice a year.
It is found at NAPA or Car Quest Stores.

SD