Stand-in South Africa skipper David Miller felt like "the worst captain on the planet" as Pakistan threatened to take their three-match Twenty20 series to a decider. 

Miller led the hosts with Faf du Plessis rested and scored a sensational 65 off just 29 deliveries to help the Proteas post 188-3 at the Wanderers after play was briefly suspended in the 18th over due to rain. 

The left-hander, who shares the record for the fastest T20 hundred in international cricket, plundered 29 off the final over from Usman Shinwari. 

However, Miller was concerned when Pakistan were 70-1 after the powerplay, Babar Azam (90) leading the charge, and admitted he felt lost at sea. 

"I thought I was the worst captain on the planet," he said with a smile after sealing an unassailable 2-0 lead in the three-match series with a seven-run triumph. "I didn't know what to do, to be honest. 

"They were always going to come hard and try to get as many runs in the powerplay. 

"We didn't start too well with the ball, we were a bit wide and short."

Pakistan needed 42 runs from their last four overs for victory, but Beuran Hendricks picked up the key wicket of Babar before Chris Morris (2-36) and Andile Phehlukwayo (3-36) worked their way through the lower order. 

"It got quite tight and stressful at the back end but the guys pulled through and did incredibly well," said Miller after Pakistan had finished on 181-7. 

"[Tabraiz] Shamsi came in and bowled incredibly well, brought the run-rate down, and [Lutho] Sipamla was absolutely incredible on his first game. As a captain I was really pleased with the two of them and then to top it off with the guys at the back end was really sweet. 

"Really pleasing to finish off on a high. We didn't leave it [the series] until the last game, so really happy about that." 

Imad Wasim removed Janneman Malan to give Pakistan an early breakthrough in the first innings and finished his four overs with stunning figures of 1-9, but captain Shoaib Malik was frustrated the rest of his bowling attack were unable to follow suit. 

Shinwari's four overs proved incredibly expensive as he went for 63 runs, while Hasan Ali conceded 48 as South Africa posted a challenging total.

Shoaib said of Imad: "He's an exceptional talent, and we need a couple of other guys to perform that way.

"Shaheen Afridi bowled brilliantly, it's just you need three or four bowlers to do well, and then you end up chasing 160 on a good wicket.

"Finishing crucial games is where we're lacking. We saw it in the last game as well. We're going to sit and talk about it, particularly the last overs."