Chicago lost its 10th straight game while wasting one opportunity after another.
A.J. Burnett and four relievers combined to blank Chicago despite the Cubs managing 10 hits. Chicago put a runner on second base in six of the innings, but could never come up with a clutch hit.
Burnett (3-2) gave up six hits and struck out six in 5 1/3 innings.
Hanrahan gave up two singles in the ninth and the Cubs had the tying run on second with one away. Hanrahan then mowed down David DeJesus on four pitches and got Starlin Castro to strike out swinging to end the game.
It was Hanrahan's 11th save.
The Pirates had lost their previous two games.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Millions of Getty images now available for free via embed tool