Table-toppers Chelsea drew 2-2 at Vidi in their final Group L in the Europa League on Thursday.
Goals from Willian and Olivier Giroud paced the Premier League side, while an Ethan Ampadu own goal and a strike from Loic Nego completed the scoreline on a frigid night in Hungary.
Brazilian winger Willian opened the scoring in the 30th minute with a fine, dipping free kick from the top of the semi-circle after being fouled by Paulo Vinicius.
Ampadu turned the ball into his own net from a corner two minutes later. And Nego hit a spectacular volley on 56 minutes to give the hosts an improbable lead.
But Giroud -- a second-half substitute -- one-upped Willian a quarter-hour from time, nestling a superb free kick into the top corner to secure the draw for Maurizio Sarri's men, who end their unbeaten group stage campaign with 16 points from six matches.
BATE became the second team to advance from the group with nine points after a 3-1 win at PAOK.