Arthur Melo notched his first goal for the Turin club in the first half with a deflected strike and USMNT midfielder Weston McKennie headed home the second after 71 minutes.
Bologna goalkeeper Lukasz Skorupski made some stunning saves to keep his side in the match and the visitors also had good chances in an entertaining encounter at the Allianz Stadium.
It was a much-needed victory for Pirlo's side following the disappointment of their 2-0 defeat to Inter Milan last weekend as it cut the gap behind league leaders AC Milan to seven points and the champions also have a game in hand.
"It's very important for us. We watched yesterday how both Milan teams dropped points," McKennie told DAZN after Milan lost 3-0 to visiting Atalanta and Inter were held 0-0 at Udinese.
"We're a game down and we still have to play both of them in Turin. We're three points closer and I think it'll be a fight to the end. We'll see who wants it more."
Juventus are fourth with 36 points from 18 games, one point behind AS Roma in third. Bologna are 13th with 20 points.
Pirlo won the first trophy of his short managerial career on Wednesday by leading Juve to a 2-0 win over Napoli in the Italian Super Cup, providing some welcome relief at the Turin giants after their meek defeat by Inter.
They got off to a good start on Sunday when Arthur's speculative effort ricocheted off Bologna's Jerdy Schouten and into the bottom corner after 15 minutes.
Skorupski then produced a superb double-save to deny Cristiano Ronaldo and Federico Bernardeschi.
Bologna came to life after the break as Juve goalkeeper Wojciech Szczesny spared Juan Cuadrado's blushes by palming his team mate's header over the bar before the Pole's diving save thwarted a whipped Riccardo Orsolini effort.
But McKennie made sure of the points by finding space to head in from a corner and Bologna again had Skorupski to thank for keeping the score down as he blocked efforts from McKennie, Adrien Rabiot and Ronaldo in the closing stages.