The Serbian second seed had looked sluggish in the first set but he offered more of a threat in the second, holding a break point for 2-0 and breaking for 3-1 when Berdych netted a backhand.
Both players saved break points in the next two games but Djokovic broke again for the set before Berdych called for the trainer and had his left thigh massaged.
Games went quickly in the final set as both players held serve comfortably until Djokovic broke to lead 4-3. Berdych lost the next two points before deciding to retire.
"The problem was my left quadriceps," Berdych said. "Was not able just to serve, move to the sides, and just feel the pain. It's no chance to just play with this guy in the condition that I was feeling.
"Just didn't make sense to be walking and just be able to finish, so that's not my style. I felt it just too much for the serve and I couldn't serve.
"So to play Novak, one of the best returners, this time to play without the serve, no chance."
Djokovic was very unhappy with the way he played.
"I don't know how to explain today's match really. In one word, catastrophe," the Australian Open champion said.
"I think the match overall and my game, it was the worst match this year for me, worst performance. But I managed to get a win, so I guess that's what matters.
"I hate it when I play this way, but I was still trying to fight within myself and try to stay focused and at least hold serve."
Djokovic will play top seed and four-times former champion Roger Federer in Saturday's final.