Mason Plumlee is staying in Denver.

The restricted free agent agreed late Sunday to a three-year, $41 million contract with the Nuggets, ESPN reported Monday.

Plumlee, 27, avoids moving to a fourth team as he enters his fifth NBA season. The Duke product was a first-round pick (22nd overall) by the Nets in 2013 before being dealt to Portland in June 2015 and then to Denver in February for Jusuf Nurkic.

The 6-11 center will anchor an impressive frontcourt alongside Nikola Jokic and free-agent acquisition Paul Millsap as the Nuggets look to return to the playoffs for the first time since 2012-13.