Group F
Olivier Giroud scored a hat trick as Arsenal advanced with a 3-0 win over Olympiakos, overturning an advantage held by the Greeks ahead of the final match.
The France striker opened the scoring in the 29th minute and struck again four minutes after halftime. He closed the scoring by converting a penalty kick in the 67th.
"Not many people gave us a chance but we are a real team," Arsenal coach Arsene Wenger said. "It is certainly one of my best European results. We had to produce a perfect performance to win and we did just that."
Olympiakos, which beat Arsenal 3-2 in London, would have advanced with a draw.
Group winner Bayern Munich beat Dinamo Zagreb 2-0 with a pair of goals by striker Robert Lewandowski.
Group G
Chelsea finally had something to celebrate in its unexpectedly poor season after qualifying for the knockout phase with a 2-0 home victory over Porto.
The hosts scored through an own goal by Ivan Marcano in the 12th and Willian sealed the victory in the 52nd.
Chelsea not only avoided the embarrassment of dropping into the Europa League, but Jose Mourinho's team advanced as the group winner. His former club, Porto, finished third and was eliminated.
Dynamo Kiev advanced in second place thanks to a 1-0 win over Maccabi Tel Aviv in Ukraine. The game was played in an empty stadium in the Ukrainian capital Kiev as part of Dynamo's punishment for racist attacks by its fans in October.
Dynamo will also have to hold the home leg of its first knockout round tie behind closed doors.
Group H
Gent gave Belgium a spot in the knockout stage after beating group winner Zenit St. Petersburg 2-1 with goals by Laurent Depoitre and Danijel Milicevic.
Even a defeat would have been enough for Gent because Lyon went to Valencia and beat the hosts 2-0.
"They were better than us and there's no excuse," said Valencia coach Gary Neville, the former Manchester United and England defender who took over the Spanish club on Sunday. "We can't be happy with how we played and we can't blame anyone."
Zenit easily won the group with 15 points, five more than Gent. Valencia was third with six points and Lyon last with four.