The Pirates have won six out of eight while climbing to a season-best three games over .500.
Bedard (4-6) struck out five, walked three and threw 99 pitches while giving up both Kansas City runs. Grilli retired the side in order in the eighth and Hanrahan did the same in the ninth for his 16th save.
Kansas City's runs came in the third when Yuniesky Betancourt doubled home Alex Gordon and then scored on a single by Mike Moustakas.
Pittsburgh produced an insurance run in the bottom of the third thanks to alert base running by Pedro Alvarez.
Alvarez was on third and Jose Tabata was on first with one away when Kansas City starter Luke Hochevar picked Tabata off base. Tabata, however, became involved in a rundown before being tagged out and while that was in progress Alvarez raced in to score.
Hochevar (3-7) gave up four runs on nine hits over six innings to take the loss.