First-half goals from Tamas Priskin and Gareth McAuley have booked Town a place in the last 16 of the Carling Cup.
Andros Townsend was the provider for both Blues' goals. The Tottenham loanee finding Priskin with a cross on 23 minutes, the Hungary international sending a looping header into the net.
McAuley then added a second on the stroke of half-time, the defender diverting Townsend's free-kick past David Forde in the home goal.
Steve Morison reduced the arrears just past the hour with an excellent goal but Town held firm over the last half hour to make it into the Fourth Round of the Carling Cup for the first time in eight years.
Roy Keane made eight changes to the side that beat Cardiff at the weekend, with only Tom Eastman, McAuley and Townsend keeping their places in the line-up.
Damien Delaney came in for his first game of the campaign after recovering from a blood clot sustained following an injury in pre-season.
Mark Kennedy was handed the skipper's armband and showed all his experience to be in the right place to curb the threat of Morison inside the first five minutes.
Former Blue, Scott Barron, had the first shot of real note on the quarter hour, Brian Murphy carrying on his form from the win at Crewe in the last round with the save.
Morison had a header comfortably saved by Murphy as Millwall edged the opening exchanges but Blues' defence held firm and Town got the breakthrough midway through the half, Townsend's excellent cross met by Priskin's header which drifted over Forde and into the net.
Colin Healy fired over from 25 yards after more good work by Townsend, the Tottenham loanee then sent crashing to the ground through a challenge from Alan Dunne, the Lions' defender yellow carded.
Barron set up his former Town team-mate Liam Trotter on 35 minutes with a cross that the midfielder got his head on, Murphy making a comfortable save.
Delaney forced the ball back to Murphy as Trotter looked to burst into the Town box, while at the other end the impressive Townsend drilled a left footer from 30 yards just wide.
Blues extended the lead right on half-time, Townsend was brought down by Danny Schofield. The winger took the free-kick himself and McAuley diverted the ball under Forde and into the net from 12 yards.
Town made a double change early in the second-half with Townsend and Healy replaced by Grant Leadbitter and Jason Scotland. Millwall boss Kenny Jackett shuffling his pack as well with veteran Neil Harris introduced for James Henry. Darren Ward also joining the action before the hour with Schofield making way.
Millwall got back in the game on 62 minutes, Morison losing Delaney and then beating Murphy from 12 yards to register his sixth goal of the season.
Town immediately made a change with Connor Wickham replacing Priskin, Leadbitter then testing Forde with a free-kick.
Trotter became the second Lion to be booked, the midfielder catching Luke Hyam with a high challenge, Trotter then failing to keep his shot down at the far post following a cross.
Hyam did well to make successive blocks from Chris Hackett on the edge of the Town box as the game entered the last 15 minutes.
Wickham picked up a yellow card after catching Dunne, then Reggie Lambe was denied by Ward as Town looked for the killer third goal.
It didn't come but Blues held firm at the other end to ensure Millwall suffered a second successive home defeat after 10 months without a loss at the Den.
The draw for the last 16 takes place on Saturday with Town hoping to end a run of eight successive away ties in cup competition.
Millwall: Forde, Dunne, Robinson, Craig, Mkandawire, Barron, Trotter, Schofield (Ward 58), Henry (Harris 58), Hackett, Morison. Subs not used: Grabban, Grimes, Laird, Mildenhall, Smith. Booked: Dunne, Trotter.
Town: Murphy, Eastman, McAuley, Delaney, Kennedy, Peters, Hyam, Healy (Scotland 53), Lambe, Townsend (Leadbitter 53), Priskin (Wickham 64). Subs not used: Fulop, Murray, Brown, Norris. Booked: Wickham.