The Brooklyn Nets and guard Spencer Dinwiddie have agreed to a three-year contract extension, the team announced Thursday.

The deal is for $34 million, league sources told ESPN's Adrian Wojnarowski. There will be a player option on the third year, sources said.

Dinwiddie was eligible for four years and $47 million, but the sides went with a shorter deal that would get him back into free agency more quickly. His new deal will pay him $10.6 million, $11.4 million and $12.3 million annually starting with the 2019-20 season, sources said.

The guard, who was playing in the G League before he signed with the Nets in December 2016, has gone on to become one of their top players and scored a career-high 39 points, the most by any player off the bench in the NBA this season, in a victory at Philadelphia on Wednesday.

Dinwiddie was third in voting for the Most Improved Player last season and could find himself in the race for the Sixth Man of the Year award this season. He is averaging 16.9 points, helping the Nets overcome the loss of scoring leader Caris LeVert to injury.

"It's just so evident, you can't take him out and he's playing great basketball,'' Nets coach Kenny Atkinson said after Wednesday's win. "Obviously, he's our engine right now, especially in the second half. All the work he's done, he's come a long way. He deserves it.''

Dinwiddie was originally a second-round pick of Detroit in 2014 but spent his first couple seasons with the Pistons and Chicago Bulls going back and forth from the G League. His big opportunity came last season, when the Nets lost point guards Jeremy Lin and D'Angelo Russell to injuries and he went on to average 12.6 points.

The Associated Press contributed to this report.