The Detroit Lions and quarterback Matthew Stafford have reached an agreement on a five-year contract extension, the team announced Monday.

The extension, tacked on to the final year of his current deal, keeps Stafford with the Lions through the 2022 season.

NFL Network's Ian Rapoport reports the deal is worth a total of $135 million. The $27-million annual average surpasses the previous record of $25 million per year being earned by Oakland Raiders quarterback Derek Carr, which he signed earlier this year.

The extension includes a $50-million signing bonus and $92 million in guaranteed money, with both figures also representing NFL records, according to ESPN's Adam Schefter.

Stafford has twice led the NFL in passing attempts but just once finished as the leader in completions. He has topped 4,200 passing yards and 20 touchdowns in each of his past six seasons, once exceeding 5,000 air yards and setting a career best of 41 touchdowns in the 2011 season.

He has twice led the league in both fourth-quarter comebacks and game-winning drives.

Stafford's record extension comes ahead of New Orleans Saints quarterback Drew Brees and Washington Redskins quarterback Kirk Cousins entering contract years.

Reigning NFL MVP Matt Ryan of the Atlanta Falcons will be due for a new contract following the 2018 season.