The match also witnessed three red cards in stoppage time, with Milan being reduced to nine men as tensions flared
Needing a win to make sure of a return to Europe's premier club competition, Juergen Klopp's side looked edgy early on but the tension was lifted just before halftime when Dutchman Georgino Wijnaldum scored from a clever pass by Roberto Firmino.
In the second half Philippe Coutinho curled in a direct free kick and Adam Lallana added a third goal.
Middlesbrough, who thought they should have had a penalty with the score at 0-0, finished as the lowest Premier League scorers this season with 27 goals.