Juventus had defeated Cagliari in nine of their previous 10 league meetings but was unable able to assert any serious authority in the match, and was nearly made to pay before killing off the game late on.
Having earlier gone close with a header against the post, Moise Kean opened the scoring for Juve five minutes before half-time in its final match of a largely disappointing 2021.
Juve survived a couple of big scares in the second half before Bernardeschi, who created Kean's opener, struck in the 83rd minute to seal a win that moves the Bianconeri within four points of fourth-placed Atalanta, which drew 0-0 with Genoa elsewhere on Wednesday (AEDT).
Kean headed Juan Cuadrado's right-sided cross against the upright with a thumping header 10 minutes into what proved a frustrating first half for the hosts.
However, the breakthrough duly arrived shortly before the interval when Kean adjusted his body to guide Bernardeschi's deflected cross past Alessio Cragno.
Cagliari, which has now conceded in 23 successive away league meetings with Juve, wasted a big chance to equalise before the hour as Dalbert steered wide from seven yards.
Joao Pedro did at least manage to test Wojciech Szczesny eight minutes later with a header down the middle that the Juve keeper tipped over.
But Juve made certain of the points through Bernardeschi's angled drive at the end of a counter, the winger ending a run of 513 days without a goal in Serie A.