Keys took a medical timeout midway through her 6-3 4-6 6-1 victory over the tournament's top seed on Saturday at Memorial Drive.
But the world No.20, despite strapping on her left thigh, finished with a flourish to claim her ninth career singles title.
Keys won the Adelaide trophy in 2020, but hadn't returned to the tournament since.
The 29-year-old and Pegula, 30, have formed a close bond in their years on tour and will soon catch the same flight to Melbourne for the Australian Open starting on Sunday.
"We can discuss the match later when we're flying together if you want," Keys told Pegula.
Keys stunned her friend early with a power-laden masterclass in returning serve in the first set.
With a series of brutal returns, Keys broke serve three times to win the set against an increasingly frustrated Pegula.
But the world No.7 instantly flipped that script in the second set, breaking Keys' serve twice to create a 3-0 lead.
Keys then called a medical time-out, before continuing playing with strapping on her left thigh.
She didn't appear outwardly hampered by her ailment, but couldn't prevent Pegula taking the second set.
Keys then produced a dominant deciding set underpinned by pure groundstroke power - she hit 40 winners to Pegula's 10 for the match.