The Reds went into the match knowing that only a win would do if they were to guarantee their place in the top four, and that made for a nervous first-half showing until Georginio Wijnaldum eased the tension right on the stroke of half time.
Liverpool were understandably eager to make a quick start to the match and brought a save from Brad Guzan inside the opening 30 seconds when Roberto Firmino's strike was comfortably gathered by the Middlesbrough keeper.
The Reds were very much on the front foot in the early exchanges, though, and Nathaniel Clyne was the next to find himself in a shooting position, but he snatched at the chance and dragged his effort wide of the far post.
Despite Liverpool's positive start to the match, events elsewhere raised the tension inside Anfield as Manchester City and Arsenal both took early leads in their games to leave Liverpool out of the top four for the majority of the first half.
The hosts' players also seemed to be feeling the pressure and they were largely limited to shots from outside the area in their attempt to break the deadlock, with Emre Can providing the best of those with a 20-yard strike that flew narrowly off target.
If nerves were frayed during the opening stages then they were stretched to breaking point midway through the first half when Patrick Bamford went down under a clumsy challenge from Dejan Lovren inside the area, only for Martin Atkinson to wave away Middlesbrough's claims for a penalty.
Coutinho drew another routine stop from Guzan shortly afterwards, but Liverpool were once again given a reminder of their fragile position when Rudy Gestede flicked a header wide of the far post at the other end.
Clear chances were tough to come by for either side, though, and Daniel Sturridge squandered one of Liverpool's better ones of the first half when he fired wide from inside the box having worked a yard of space for himself to shoot.
The tension was clear to see from Liverpool's choices on the ball, with Lallana and Firmino the next to try their luck with tame shots from distance, but the mood around Anfield changed completely on the stroke of half time when they finally broke the deadlock.
Firmino's flick around the corner released Wijnaldum into the penalty area, and the Dutchman put everything behind his shot as he powered an effort past Guzan at the near post.
The relief on the pitch and the stands was palpable as the two sides went into the break, and Liverpool gave themselves even more breathing space with a second goal six minutes after the restart when Coutinho curled a long-range free kick past Guzan on the goalkeeper's side, moving clear as the club's top scorer this season in the process.
Firmino was only prevented from adding a third by a George Friend block shortly afterwards, but the hosts would not be denied for much longer and Lallana put the match - and a top-four finish - beyond any doubt in the 56th minute when he provided a composed finish at the end of a quick counter-attack.
Boro should have pulled a goal back immediately to perhaps put the party on hold, but Adam Forshaw sent his effort narrowly wide of the target with only the keeper to beat.
Liverpool were quickly back up the other end, though, and Coutinho was denied by the fingertips of Guzan before Firmino failed to make the most of a good shooting opportunity inside the area.
The hosts looked like scoring every time they came forward at that stage, and Wijnaldum was the next to come close with an ambitious volley from Firmino's cross that he sliced into the arms of Guzan.
Sturridge and Can also threatened to add to Liverpool's tally before Boro came close to a late consolation when Forshaw was picked out by a lofted ball into the box only to skew his volley wide of the target when he should have done better.
Liverpool held on for a fourth consecutive clean sheet, though - the first time they have achieved that in the Premier League since February 2015 - as they wrapped up fourth place in Jurgen Klopp's first full season in charge of the club.
The Reds have qualified for Champions League football for just the second time in the past eight years, finishing the campaign one point clear of Arsenal in fifth.