It gave Liverpool a club-record 88 Premier League points, beating the 86 managed in the 2008-09 season, but there is still a first English title in 29 years to secure.
Liverpool holds a two-point advantage over Manchester City, which has a game in hand and plays at Manchester United on Wednesday.
Liverpool's breakthrough against relegation-threatened Cardiff only came in the second half - the sixth successive league game which Liverpool has won by scoring a winner after the break.
Trent Alexander-Arnold delivered a corner to the near post where Wijnaldum met it to grab the opener in the 57th minute.
Liverpool was disrupted further by losing Fabinho following a clash of heads and Milner was sent on to play what proved to be a decisive role.
Milner netted from the penalty spot in the 81st minute after Sean Morrison grappled Mohamed Salah, who fell to the ground.
More AP soccer: https://apnews.com/apf-Soccer and https://twitter.com/AP_Sports
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.