SAN FRANCISCO (AP) The Arizona Diamondbacks have traded closer Brad Ziegler to the Boston Red Sox in exchange for two minor league prospects.

The deal was announced late Friday night after the Diamondbacks' 6-2 loss to the San Francisco Giants.

Ziegler, who owns Arizona's club record of 43 consecutive saves, is scheduled to be a free agent at the end of the season. Diamondbacks general manager Dave Stewart had been in talks with Ziegler's agents regarding an extension but those negotiations stalled.

More from FoxSports

That led to the trade that netted prospects Jose Almonte, a right-handed pitcher, and infielder Luis Alejandro Basabe.

Siegler was 2-3 with a 2.82 ERA and 18 saves in 36 appearances this season. For his career, he is 32-24 with a 2.49 ERA and 81 saves over nine seasons.