BOSTON -- The Boston Red Sox are hoping that two big trades will help them get back to the playoffs after missing out three years in a row.

The first was a genuine blockbuster that sent Adrian Gonzalez, Carl Crawford, Nick Punto and Josh Beckett to the Los Angeles Dodgers and freed up more than $250 million in future salaries. The second was the deal that brought John Farrell back to Fenway Park on Sunday.

The Red Sox hired Farrell to be their new manager after pursuing him for more than a year, agreeing to trade infielder Mike Aviles to the Blue Jays to pry their former pitching coach out of the manager's chair in Toronto.

"I'm extremely excited to be returning to the Red Sox and to Boston," Farrell said in a statement released by the Red Sox. "I love this organization. It's a great franchise in a special city and region, with great fans, and we want nothing more than to reward their faith in us."

Farrell had been the Toronto manager the past two seasons, posting a 154-170 record with two fourth-place finishes. He had one year remaining on his contract with the Blue Jays, allowing them to demand compensation from Boston.

It's the second time the Red Sox have pursued Farrell for their managerial job, closing the deal this time by working out a rare but not unprecedented trade for an active manager. Boston will give up Aviles, who hit .250 with 13 homers and 60 RBIs last season, and get right-hander David Carpenter in return.

It is the seventh time in major league history that one team has traded for a manager while he was under contract to another, the Red Sox said. Last year, the Miami Marlins obtained Ozzie Guillen from the Chicago White Sox in a deal that also included three players.

Farrell received a three-year deal in Boston, which also interviewed San Diego Padres special assistant Brad Ausmus, New York Yankees bench coach Tony Pena, Los Angeles Dodgers third base coach Tim Wallach and Baltimore Orioles third base coach DeMarlo Hale.

"We met some outstanding managerial candidates in this process," Red Sox president Larry Lucchino said in the statement. "John Farrell brings a unique blend of managerial experience, leadership and presence, pitching expertise, front office experience, and an established track record with many members of our uniformed staff and members of our front office. He will hit the ground running."

The pitching coach in Boston for four years, Farrell was the heir apparent to Terry Francona before going to Toronto two seasons ago when it seemed like Francona would be sticking around long-term. When Francona was let go after an unprecedented collapse in September 2011, the Red Sox tried to pry Farrell loose from the Blue Jays.

But Toronto general manager Alex Anthopoulos asked for a top player in return for Farrell, who had been there only one season and gone 81-81.

So the Red Sox turned to Bobby Valentine to bring discipline to a clubhouse in which players drank beer and ate fried chicken in the clubhouse during games. But the former New York Mets and Japanese Leagues manager alienated so many players that the team was forced to bail out on the season, trading three highly paid but underperforming players for a chance at a fresh start in 2013.

Valentine was fired after finishing in last place with a 69-93 record – four games behind Toronto and the team's worst record since 1965. General manager Ben Cherington was back in the market for a manager, and this time he didn't need a hard-line disciplinarian.

"The team is in a different point than it was last year when we hired Bobby," Cherington said after firing Valentine. "The roster was fairly mature and we felt, mistakenly in retrospect, but we felt at the time, that we had a chance to win and the team was ready to win. We're now at a different point."

Farrell, 50, had a promising pitching career with the Cleveland Indians before an injury kept him out for the entire 1991 and `92 seasons. He returned to pitch sparingly in four more seasons, finishing his career with a 36-46 record and a 4.56 ERA.

He coached at Oklahoma State, where he pitched in college, from 1997-2001 and then spent five years in the Indians' front office before Francona, a former Cleveland teammate, brought him to Boston as pitching coach. Under Farrell's guidance from 2007-10, Red Sox pitchers held opponents to an AL-low .254 batting average and led the league with in 4,771 strikeouts.

Farrell is familiar with Red Sox management from his time in Boston and has worked with many of the club's pitchers – including starters Jon Lester and Clay Buchholz, who were All-Stars under his tutelage.

"His broad set of experiences, and exceptional leadership skills, make him the ideal person to lead our team," Cherington said in the news release. "I have known him in various capacities throughout my career, and I hold him in the highest regard as a baseball man and as a person."

Aviles, 31, is a career .277 hitter who played 136 games for the Red Sox in 2012, mostly at shortstop.

Carpenter, 27, is 1-5 with one save and a 5.70 ERA over 67 career relief appearances with the Astros and Blue Jays. He appeared in 33 games in 2012, 30 with the Astros before being sent to the Blue Jays in a 10-player trade on July 20; he also made 23 minor-league appearances last season.

Originally a catcher, Carpenter converted to pitching in 2008.

Also on HuffPost:

Loading Slideshow...
  • Phil Humber's Perfect Game - April 21, 2012

  • Ozzie's Castro Comments - April 7, 2012

  • Chris Davis Gets The Win - May 6, 2012

  • Scott Hairston's Cycle - April 28, 2012

  • Umpire's Huge Blown Call - May 2, 2012

  • Jared Weaver's No-Hitter - May 2, 2012

  • Josh Hamilton Hits 4 HRs - May 10, 2012

  • Beckett Gets Booed In Boston - May 10, 2012

  • Andy Pettitte Returns - May 13, 2012

  • Bryce Harper's First Homerun - May 14, 2012

  • Stanton's Slam Breaks Scoreboard - May 21, 2012

  • Johan Santana's No-No - June 1, 2012

  • Matt Cain's Perfecto - June 13, 2012

  • Dickey's Consecutive One-Hitters - June 13, 18

  • Twins' Incredible Double Play - June 16, 2012

  • Aaron Hill's Second Cycle - June 18, 2012

  • DeWayne Wise Fools Umpire - June 26, 2012

  • Mike Trout's Amazing Catch - June 27, 2012

  • Lightning Strikes In Texas - July 8, 2012

  • Ryan Howard Returns In Style - July 16, 2012

  • Damon's Clutch Catch - July 20, 2012

  • Cabrera Hits His 300th - July 22, 2012

  • Umps Overturn Questionable Call - July 23, 2012

  • Harvey Makes History - July 26, 2012

  • Rangers Rally - August 1, 2012

  • Upton Brothers' Milestones - August 3, 2012

  • Verlander Strikes Out 14 - August 6, 2012

  • Cabrera's Big Walk-Off - August 6, 2012

  • Machado Goes Deep Twice - August 10, 2010

  • Trout's Robbery - August 11, 2012

  • Pierzynski Scores From Home - August 13, 2012

  • King Felix Gets His Crown - August 15, 2012

  • Buchholz' Perfect Inning - August 16, 2012

  • Chipper's Big Night - August 16, 2012

  • Zito's Pitch Fail - August 18, 2012

  • Dunn Hits 400th Homer - August 18, 2012

  • Guthrie's Controversial One-Hitter - August 19, 2012

  • Giants' Circus Catch - August 20, 2012

  • A's Turn Triple Play - August 21, 2012

  • Beltre's Three Bombs - August 22, 2012

  • Davis Dominates - August 24, 2012

  • Beltre Hits For Cycle - August 24, 2012

  • Gonzalez' Big L.A. Debut - August 25, 2012

  • Granderson Hits 200th HR - August 26, 2012

  • Profar's Debut Homer - September 2, 2012

  • Reds' Strange Twist - September 4, 2012

  • Maybin's Big Catch - September 5, 2012

  • Belt's Homer Finds The Cove - September 5, 2012

  • McCarthy's Scary Injury - September 5, 2012

  • A-Rod Hits 300 In NY - September 7, 2012

  • Trout Robs Fielder - September 8, 2012