You don't really need to watch either Millennium or The Lone Gunmen to understand the events in the main X-Files series. Millennium isn't really a proper spin-off; it was just created by many of the same people. The only place where it intersects with the X-Files is in the season seven episode of the X-Files called "Millennium". This episode wraps up the entire Millennium story, so you can watch all of that series and all of the X-Files up to season seven in any order before watching that episode.
The Lone Gunmen is a proper spin-off, since the characters Langley, Frohike, and Byers appeared in the X-Files for years before they got their own show. They appeared in all nine seasons of the X-Files, but they didn't get their own show until the eighth season. To watch their appearances in order, watch the first eight seasons of the X-Files up to episode 11 (The Gift, original air date February 4, 2001), which was their last appearance before they got their own show. Then watch the first six episodes of The Lone Gunmen (which premiered March 4 through March 30, 2001), switch back to the X-Files for a few episodes up through episode 15, watch episode seven of TLG, episode 16 of the X-Files, then finish up TLG before you get to the season eight finale of the X-Files.