"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 1 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 RBI last season, and get righthander 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 3-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 4 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.
Yankees ace CC Sabathia will have his pitching elbow examined by Dr. James Andrews following inflammation that landed him on the disabled list in August. An MRI showed a bone spur in the left elbow and the Yankees believe it has existed since he pitched for the Cleveland Indians from 2001-08.
Also Saturday, Yankees shortstop Derek Jeter had surgery to repair a broken left ankle. Dr. Robert Anderson operated in Charlotte, N.C., and the Yankees said complete recovery for their 38-year-old captain is expected to take 4 to 5 months.
* Japanese high school pitcher Shohei Otani says he will pursue a career in Major League Baseball instead of turning professional in Japan.
Otani, a 6-4 righthander who has thrown a fastball between 99 and 100 mph, has been scouted by several major league teams including the Los Angeles Dodgers and Boston Red Sox.
Otani was expected to go in the first round of Thursday's amateur draft in Japan. If he signs with a major league team, Otani, 18, would become the first potential top draft pick to make the direct jump from a Japanese high school to the United States.
* Heath Bell became the latest player jettisoned by the Miami Marlins when he was dealt to the Arizona Diamondbacks, who also acquired infielder Cliff Pennington from the Oakland for outfielder Chris Young.
Arizona obtained Pennington and minor league infielder Yordy Cabrera from Oakland for Young and cash, then sent Cabrera to the Miami Marlins for Bell and cash.
Also over the weekend, Arizona exercised a $6.5 million option on closer J.J. Putz.