The Buffalo Bills have agreed on a restructured contract with quarterback Tyrod Taylor, ending speculation that he wouldn't be with the team this coming season.

Tyrod Taylor's Past Two Seasons Tyrod Taylor threw 37 touchdown passes and 12 interceptions in the past two seasons, the sixth-best ratio in the NFL. NFL Rank TD-INT ratio 3.1 6th Total QBR 69.2 8th -- ESPN Stats & Information

The Bills are also expected to finalize a deal on Thursday to sign fullback Patrick DiMarco, who played for the Falcons last season. Once completed, it's expected to be for four years for $8.5 million, with $4 million guaranteed, a source told ESPN's Adam Caplan.

Taylor, 27, has started 29 games over two seasons in Buffalo. He is 14-14 as the team's starting quarterback; the Bills also won his debut in 2015 when Taylor played the first snap of the game at wide receiver.

"We are excited about the opportunity to keep Tyrod with the Bills," coach Sean McDermott said in a statement. "I've gotten a chance to know Tyrod and study him over the past several weeks, and he is both a great person and competitor. Doug and I are confident this was the best move for the Bills at this time."

McDermott was hired in January to replace former coach Rex Ryan -- a staunch supporter of Taylor. General manager Doug Whaley retained control of the Bills' roster after McDermott was hired but said he would make a decision on Taylor in concert with the new coaching staff.

Since the start of the 2015 season, Taylor ranks eighth in Total QBR (69.2), 12th in passer rating (94.2), 20th in completion percentage (62.6), 12th in yards per pass attempt (7.42), and sixth in touchdown-to-interception ratio (3.08). He leads NFL quarterbacks in rushing yards (1,148) since 2015 but was sacked 78 times over that span, fifth most in the NFL.

The Bills front office's faith in Taylor appeared to erode last season, when several of his passing statistics declined from their 2015 levels amid injuries to Sammy Watkins and several other of the team's receivers. After firing Ryan, the Bills chose to deactivate Taylor for their regular-season finale in order to avoid paying him his $27.5 million salary in 2017 that would be guaranteed if he suffered a serious injury.

DiMarco, 27, is a former undrafted pickup of the Chargers out of South Carolina who evolved into a Pro Bowl player in 2015. He was a Pro Bowl first alternate this past season for the Falcons as his blocking helped paved the way for Pro Bowl running back Devonta Freeman, who notched his second consecutive 1,000-yard season.

His run blocking and pass protection are his biggest assets, but he showed he could also be a reliable pass-catcher out of the backfield the last two seasons with 20 receptions for 162 yards and three touchdowns on 27 targets.

DiMarco's value extends to special teams, where he has been a regular contributor to the units coached by Keith Armstrong.

He made his NFL debut with the Chiefs in 2012, starting four games. He never played for the Chargers, as he was released after breaking a bone in his foot.

The Bills also announced on Wednesday that they had re-signed punter Colton Schmidt.

ESPN's Mike Rodak and Vaughn McClure contributed to this report.