The teams had played to a 1-1 draw but after winger Deon Hotto, the hero for Namibia when they won the title in South Africa 12 months ago, missed his spot-kick Botswana earned a place in the Last 4.
Botswana took the lead five minutes after halftime as Onkabetse Makgantai’s header was cleared off the line, but the clearance smashed off the crossbar and against Free State Stars defender Dacosta Angula, before trickling into the net.
Namibia poured forward in search of an equaliser and were awarded a penalty as the ball struck the arm of a defender.
Botswana coach Peter Butler was so vociferous in his protests that he was eventually sent to the stands.
Midfielder Hendrik Somaeb kept his cool and converted from the spot.
Namibia had numerous chances to win the game after that, but the ball would not go in and they had to settle for the lottery of the shoot-out.
The first nine spot-kicks were scored, but Hotto’s effort was saved by Botswana keeper Mwampole Masule, who had been an early substitute for injured former Platinum Stars gloveman Kabelo Dambe,
Goalkeeper Reyaad Pieterse saved two penalties in the shoot-out to take his side to a 4-2 victory and book a semifinal place with either Zambia or Swaziland on Wednesday.
South Africa had much of the ball against Lesotho, but battled to create clear-cut chances and it was their neighbours who grabbed the lead.
Jane Thabo-Ntso has been superb in this COSAFA Castle Cup tournament and he grabbed his third goal with a superb lob over Pieterse on 19 minutes.
It was another fine finish from the exciting 20-year-old winger.
But South Africa kept on pressing and they were rewarded when Tebogo Moerane crossed from the left and Gift Motupa had the easiest of headers to equalise.
Motupa was later sent off for a second bookable offence but South Africa were able to hold to take the game to penalties, where Pieterse performed his heroics.
Both Lesotho and Namibia now drop into the Plate competition.
Sunday’s Cup quarterfinals see in-form Swaziland take on Zambia and guest nation DR Congo play Mozambique.
Swaziland stormed to the top of their group with seven points from nine and have midfielder Felix Badenhorst, top scorer in the COSAFA Castle Cup with five goals, in the form of his life.
Zambia have brought a locally-based selection that is packed with budding young talent and are always among the favourites in the COSAFA Castle Cup.
DR Congo have also brought the majority of their winning African Nations Cup squad, though they do not have players from TP Mazembe, who are in African Champions League action.
Coach Florent Ibenge is one of the top coaches on the African continent though and he will have his young side well drilled.
They have a new coach in former Portugal international Abel Xavier, who brings plenty of experience and know-how to the team.
Both those matches will be played at the Sam Nujoma Stadium.
SATURDAY’S QUARTERFINAL RESULTS
South Africa 1 (Motupa 66’) Lesotho 1 (Thabo-Ntso 19’) – SA win 4-2 on pens
Botswana 1 (Angula 50’og) Namibia 1 (Somaeb 83’pen) – Botswana win 5-4 on pens
SUNDAY’S QUARTERFINAL FIXTURES
Zambia vs Swaziland (KO 15h00 local, 14h00 GMT) – Sam Nujoma Stadium
DR Congo vs Mozambique (KO 17h30 local, 16h30 GMT) – Sam Nujoma Stadium
Matches Played: 14
Goals scored: 31
Biggest victory: Zimbabwe 5 Seychelles 0 (Group A, June 15)
Most goals in a game: 5 – Zimbabwe 5 Seychelles 0 (Group A, June 15)
5 goals – Felix Badenhorst (Swaziland)
3 – Gabadinho Mhango (Malawi), Jane Thaba-Ntso (Lesotho)
2 – Lawrence Mhlanga (Zimbabwe), Ronald Pfumbidzai (Zimbabwe)
1 – Luis Dorza (Mauritius), Claudel Fanomenza (Madagascar), Miracle Gabeya (Malawi), Teenage Hadebe (Zimbabwe), Hlompho Kalake (Lesotho), Jeremea Kamela (Lesotho), Tumelo Khutlang (Lesotho), Sera Motebang (Lesotho), Gift Motupa (South Africa), Tatenda Mudehwe (Zimbabwe), Njubulo Ndlovo (Swaziland), Wonder Nhleko (Swaziland), Hendrick Somaeb (Namibia), Andy Sophie (Mauritius), Obadiah Tarumbwa (Zimbabwe)