You have a couple of options. Either become an expert on keeping your emission systems in top shape or find someone who can. I was fortunate that I had a ASE master tech who knew the old school emission systems very well, and was able to keep my vehicles smog legal. One of the things I recall he had to do many times on my various Toyota and Honda vehicles was clean off the carbon build up on the pistons. The piston carbon buildup can glow and create the high temperatures resulting in excessive NOX readings, even with the EGR systems operational. The old school fix was to use the GM top cleaner additive, but that was outlawed years ago. His solution was water injection cleaning. I recall he told me he had to use over two gallons of water to finally get an old 1985 22RE engine to pass. But as OSS commented, make sure your EGR system is fully functional, and if so, then maybe try the water cleaning procedure. Unfortunately it is a bit more involved with an EFI engine.