Source: Edward Mujica to Red Sox

The Boston Red Sox on Thursday agreed to terms on a two-year, $9.5 million deal with right-handed reliever Edward Mujica, according to a baseball source.

The deal is pending a physical.

The 29-year-old was the closer for a time with the St. Louis Cardinals this past season but lost the job in September and was not a factor in the postseason, making just two appearances.

For the season, Mujica put up impressive numbers -- a 2.78 ERA, 37 saves, 46 strikeouts and just five walks in 64 2/3 innings -- but lost the team's confidence down the stretch and was replaced by Trevor Rosenthal as closer after blowing his fourth save Sept. 19.

Mujica, who was scored upon in six of his final 10 regular-season appearances and had an 11.05 ERA in September, had a groin injury and shoulder soreness that might have contributed to his decline down the stretch.

He took over as closer in April after the Cardinals lost Jason Motte to Tommy John surgery and thrived, converting his first 21 saves in a dominant run through the first three months of the season.

Over his eight-year career, which has spanned four teams, Mujica has struck out 350 and has walked just 68 in 381 innings.

Mujica joins a strong Red Sox bullpen that's already in good shape at closer (Koji Uehara) and in setup roles (Junichi Tazawa, Craig Breslow & Co.), though he could join the late-innings mix.