The Bills announced the hiring on Friday after the two sides met for most of the day to negotiate the contract. The team did not divulge terms of the deal, though a person familiar with talks told The Associated Press that the contract runs for more than one season.
The person spoke on the condition of anonymity because the Bills do not release contract information.
Wannstedt returns to the NFL after spending the past six years coaching the University of Pittsburgh, where he was forced to resign last month.
Wannstedt is a defensive specialist and will help oversee a defense that struggled last season. The Bills' defense was last in the NFL against the run, allowing 2,714 yards rushing -- the second-highest total in franchise history. Buffalo allowed 200 yards eight times last season.
In Buffalo, he'll be working under Gailey, who went 4-12 in completing his first season as the team's head coach.
It's a role reversal for the two. Wannstedt had taken over coach of the Dolphins in 2000, when he hired Gailey to be his offensive coordinator. The two spent two seasons together before Gailey left to become the head coach at Georgia Tech.
"Chan's had success everywhere he's been," Wannstedt said in a statement released by the team. "Knowing what he's about as a football coach, knowing what he believes in and having worked with him in Miami, I know he has the winning formula."
Aside from his title as assistant head coach, Wannstedt will also serve as the team's inside linebackers coach, filling the spot left open after the Bills dismissed DeMontie Cross two weeks ago.
"We are extremely pleased to have Dave Wannstedt join our staff," Gailey said. "I look forward to him being able to help our team in many ways. With his amount of experience, he certainly should be able to do that."
He was also the defensive coordinator under Jimmy Johnson in helping the Miami Hurricanes win the national championship in 1987.
Wannstedt has held Gailey in high regard since working with him in Miami, where he essentially handed over the running of the offense to his coordinator.
"It was really important for me, particularly in my first year or two in Miami, to have someone like Chan," Wannstedt told the AP in July. "It was like having two head coaches on the staff. We were able to talk about personnel things, offense and defense."
Wannstedt was particularly impressed with Gailey's football philosophy and how he devised game plans to suit a team's strengths.
"Chan always had the ability to understand the big picture," Wannstedt said. "He understands both sides of the ball. He's not just a quarterback coach. He understands what's going on on defense. And I think that's what gives him the ability to dial up plays."
Copyright 2011 by The Associated Press