Updated

The Red Sox have acquired All-Star closer Joel Hanrahan from the Pittsburgh Pirates in a six-player deal.

Boston completed the trade Wednesday, also receiving infielder Brock Holt. The Red Sox gave up right-handers Mark Melancon and Stolmy Pimentel, infielder Ivan DeJesus Jr. and first baseman-outfielder Jerry Sands.

Over the past two seasons, the right-handed Hanrahan had 76 saves, fourth most in the National League, and a 2.24 ERA. Last season, he was 5-2 with a 2.72 ERA and 36 saves.

Holt spent most of last season at Double-A Altoona, then hit .292 in 24 games with the Pirates, all in September.

Melancon was 0-2 with a 6.20 ERA in 41 relief appearances in his only season with Boston. Pimentel spent the season at Double-A Portland. Sands and DeJesus were obtained in a trade that sent Josh Beckett, Carl Crawford and Adrian Gonzalez to the Los Angeles Dodgers on Aug. 25.