Cole gave up six runs (five earned) and eight hits, striking out six and walking two in his five-plus innings.
The winning pitcher was Michael Tonkin (3-1), who did not allow a hit over two scoreless innings.
Lourdes Gurriel Jr. homered twice, scored four runs and had four RBIs and Christian Walker also homered for Arizona, which had its win streak snapped at three.
Pittsburgh starter Roansy Contreras (3-3) allowed five runs and nine hits in five innings, with four strikeouts and three walks.
Yarbrough allowed one run on three hits over 5 2/3 innings, his longest start since July last year with the Tampa Bay Rays.