I was using an old bag of Miracle Gro potting mix that my dad bought long ago. Not sure if it was a coincidence, but my plants got infested with gnats. It was frustrating for awhile, using yellow stickies and Gnatrol. They only reduced the number of gnats, but just could not get rid of all of them. Then I saw a YouTube video of a guy using Neem cake with great success. I got some Neem cake myself in August last year, and it obliterated the gnats and I haven't seen any of them since. Unlike in the video, I did not top dress my soil with the product.
The video referenced: