The visitors started the game on the front foot and took the lead in the seventh minute as George Boyd found Lee Tomlin, who lifted the ball into the top corner.
Millwall responded almost immediately as James Henry lifted the ball over Posh keeper Robert Ojejnik.
Peterborough were impressive going forward and regained their lead in the 32nd minute as Boyd once again raided into the box before finding Tommy Rowe, who smashed the ball into the net.
After the break it got worse for the home side as the visitors scored again as Tomlin got his second of the evening with Boyd again the provider.
Nathaniel Mendez-Laing made it four with a superb solo effort beating several players before firing a left-footed shot past David Forde.
Boyd got a deserved goal to make it five for the visitors as he latched onto Gayle's pass and slotted the ball into the net.