Despite the result, Juventus managed to finish as Group H winners, with United spoiling their opportunity to jump ahead of their Italian rivals.
Although they were victorious on Wednesday, Valencia dropped to the Europa League and Young Boys finished bottom.
Young Boys picked quite the opponent to beat for their first-ever win in the Champions League group stage. Guillaume Hoarau was the hero at the Stade de Suisse Wankdorf, scoring a first-half penalty before doubling the lead in the second with a goal on the counterattack.
Super substitute Paulo Dybala cut the hosts' advantage in half in the 80th minute and nearly salvaged a point in stoppage time with a ferocious shot from distance. However, the linesman deemed Cristiano Ronaldo to be offside when the shot was taken.
United would have finished first with a win over Valencia, but a sloppy own goal by defender Phil Jones handed the Andalusians the three points. Jones' miscalculated back pass rolled beyond incoming goalkeeper Sergio Romero and into United's net for the fatal blow.
The surprising results came after Real Madrid suffered a humiliating 3-0 defeat to CSKA Moscow and Roma a 2-1 loss to Viktoria Plzen. Like Juventus and United, they had already booked their places in the round of 16.