It was the first time the Lilywhites had scored four goals in a Championship game in the 2021/22 season and it was a case of saving their best to last.
They were too good for Boro who needed to win to stand a chance of breaking into the top six.
Emil Riis scored twice and will be claiming a hat-trick, although the first one credited to him went down as a Dael Fry own goal.
Alan Browne had opened North End’s account with a fine finish from Brad Potts’ cross.
Riis’ shot deflected off Boro defender Fry for the second to give PNE a comfortable 2-0 half-time lead.
Marcus Tavernier’s far post header saw Boro pull one back early in the second half but Riis chipped a third goal for the home side and then netted from the penalty spot after Paddy McNair had been sent-off for handling Cameron Archer’s shot on the line.
Victory saw PNE finish in 13th place, the same position as last season but with 64 points – three more than a year ago.
Paul Huntington was introduced into the action for the last 11 minutes, the Cumbrian Cannavaro bidding farewell to PNE after 10 years.
Bambo Diaby replacing Patrick Bauer at the heart of the back three was the one change to the starting XI made from last week’s Gentry Day win at Barnsley.
The first 10 minutes or so of the contest saw both teams looking to find their feet, with little in the way of goalmouth action.
Steadily though, North End got the better foothold and started to play some very good football, exploiting the space left by Middlesbrough who needed to win the game to keep alive their play-off hopes.
Riis’ 11th minute drive from Daniel Johnson’s pass, deflected off a defender and flew just over the bar, Johnson later setting up a half-chance for Browne who drove a first-time shot straight into the gloves of Boro goalkeeper Luke Daniels.
North End took the lead in the 24th minute, the origins of the goal a corner on the left side.
Ben Whiteman played it short to Johnson who returned the ball into his path. Whiteman's cross was punched clear by Daniels to the far side of the box where it was chased by Diaby.
The defender laid to back to Potts, his first-time cross brought down with his chest by Browne who then hooked a right-foot finish from 12 yards across the keeper.
Johnson saw a corner travel straight into the net at the near post but referee Tim Robinson disallowed it for a foul on the keeper.
PNE’s second goal came 10 minutes before half-time, Riis chasing a ball down the left channel and holding it up on the side of the box.
With his back to goal, Riis turned inside between two defenders to move into the box and hit a low shot was struck Fry and deflected into the net at the near post.
Riis celebrated although the goal went down officially as a Fry own goal.
Ali McCann guided a low shot inches the wrong side of the far post after breaking into the box from Cameron Archer’s pass – it being McCann’s sliding tackle which had initially won possession.
Boro halved the deficit three minutes into the second half, Anfernee Dijksteel’s cross from the right arching over Daniel Iversen and finding Tavernier at the far post who got there ahead of Potts to head home.
North End swiftly restored their two-goal advantage, making it 3-1 in the 52nd minute.
Archer took possession in the Boro half and his through ball played in Riis behind the visitors’ defence. Riis met it on the edge of the box, his first touch being to lift a fine chip over the keeper and into the net.
It what might be his last PNE appearance, Iversen made a stunning save from Boro substitute Folarun Balogun, getting in the way of his shot at point-blank range in the goalmouth.
Whiteman whipped in a free-kick from the edge of the box which Daniels dived to push past the near post and behind for a corner.
Moments later North End had a fourth goal and Boro were down to 10 men.
Archer tricked his way into the box from the left channel and struck a shot past the keeper which McNair blocked on the line with his hand.
Mr Robinson pointed to the spot and pulled out the red card, McNair heading off for an early bath.
Riis stepped up and hammered the penalty low past the keeper, the stadium announcer awarding him his hat-trick even if the official stats won’t.
With victory tied-up, it was time for Huntington to come on for his farewell appearance, replacing Diaby.
The Cumbrian Cannavaro got a rousing reception from a bumper crowd, a fitting way to sign off.
He almost got on the scoresheet in the 86th minute, meeting a corner from fellow sub Ryan Ledson and sending a header just over.
PNE: Iversen, Van den Berg, Diaby (Huntington 79), Lindsay, Whiteman (Ledson 85), Potts, Browne, McCann, Johnson, Archer, Riis (O’Neill 82). Subs (not used): Ripley, Cunningham, Evans, Maguire.
Middlesbrough: Daniels, Dijksteel (Connolly 66), Fry, McNair, Tavernier, Howson, Crooks, McGree, Jones, Sporer (Coburn 62), Watmore (Balogun 62). Subs(not used): Lumley, Peltier, Bamba, Bola.
Referee: Tim Robinson (West Sussex)
Attendance: 17,691 (5,688 away)