The Bills will send two undisclosed draft choices to Minnesota, while the Vikings will send an undisclosed draft choice to the Bills with Cassel, the teams announced.
The trade, which comes one day after the Bills agreed to trade linebacker Kiko Alonso to the Philadelphia Eagles for running back LeSean McCoy, cannot be made official until the new league year begins Tuesday at 4 p.m. ET.
Cassel, 32, is expected to compete with EJ Manuel to become the Bills' starter at quarterback this season. Manuel was benched after four games last season in favor of Kyle Orton, who retired after the season.
"It's a great opportunity (for Cassel)," Vikings offensive coordinator Norv Turner told the St. Paul Pioneer Press. "He wants that opportunity to be a starter, and obviously we wish him the best."
The Bills entered the offseason wanting to acquire at least one veteran quarterback to compete with Manuel. They tried to sign free agent Josh McCown last month, but he decided to join the Cleveland Browns.
Cassel, who is entering the final season of his contract, will count for $4.75 million against the Bills' salary cap. He is due to make $4.15 million in 2015 and has a $500,000 roster bonus due on the seventh day of the league year.
His departure from Minnesota means the Vikings will be in the market for another backup quarterback behind Teddy Bridgewater; Christian Ponder is due to hit free agency, and practice squad player Pat Devlin is the only other quarterback on the Vikings' roster.
Cassel started three games for the Vikings last season, posting a 1-2 record. He completed 57.7 percent of his passes for three touchdowns and four interceptions and had a 65.8 quarterback rating.
"He will be a locker room favorite and a guy who gives them a chance to make a playoff run," Vikings tight end Kyle Rudolph wrote in a text to the Pioneer Press.
Cassel, who signed a two-year deal with the Vikings in 2013 to back up Ponder, wound up starting six games for Minnesota that season and ended the year as the No. 1 quarterback after a season in which the Vikings used three starters. He began 2014 as the starting quarterback, as the team sought to groom Bridgewater, but after Cassel broke his foot while scrambling in Week 3 in New Orleans, Bridgewater asserted himself as the starting QB.
"I'm a big fan of Matt's," Turner told the Pioneer Press. "It's just too bad (about) the injury he had, because I think he was getting ready to have a real solid year."
After serving as a backup to Carson Palmer and Matt Leinart at USC, Cassel was drafted in the seventh round of the 2005 draft by the New England Patriots. He backed up Tom Brady for three seasons until 2008, when Brady suffered a season-ending knee injury in Week 1 and Cassel replaced him.
Cassel went 10-5 as the Patriots' starter in 2008, setting career highs in passing yards (3,693) and completion percentage (63.4 percent). The Patriots assigned Cassel the franchise tag after the season before trading him to the Kansas City Chiefs.
He went 19-28 as the starter in four seasons with the Chiefs before being released.
In his 10-year career, Cassel has appeared in 90 games, including 71 starts, and has thrown for 15,727 yards, 96 touchdowns and 70 interceptions on 1,397-of-2,369 passing (59 percent).
Information from ESPN.com Vikings reporter Ben Goessling contributed to this report.