Pompey, who were looking to close the gap on the second-placed Tykes to a single point going into the final day on Saturday, fell two goals behind at home to Peterborough.
Lee Tomlin swept in his first goal since January and Ivan Toney powered in a header to double Posh’s lead.
Portsmouth hauled themselves level with a deflected effort from Ben Close and Christian Burgess’ close-range finish, only for Toney to rifle in a 75th-minute winner.
At Highbury Stadium, Sunderland went ahead through Lee Cattermole’s header from a corner, but Paddy Madden slotted home an equaliser before Ashley Eastham slammed in a last-gasp winner.
Bury will play in League One next season after their promotion was confirmed following a 1-1 draw at Tranmere, who clinched a play-off spot.
With MK Dons and Mansfield facing each other on the final day, a point was enough for the Shakers, who levelled through Danny Mayor after James Norwood had scored his 30th goal of the season.
Newport moved into the top seven with a 2-0 win against Oldham, with Mark O’Brien and Robbie Willmott scoring.
Bristol City remain in the play-off hunt in the Championship after coming from behind to beat Millwall 2-1.
Lee Gregory volleyed the Lions in front but they spurned the opportunity to extend their lead when Shaun Williams’ penalty was saved by Max O’Leary.
The Robins levelled shortly afterwards through Jamie Paterson and snatched the points when Famara Diedhiou lashed home.