South Africa's rand weakened to a near six-month low against the dollar on Friday, falling through key support and dragging local bonds down with it before recouping some losses as demand for longer dated paper picked up.

Stocks ended a touch higher, extending gains to a fourth day and hitting a new 31-month high, led by Sasol after the petrochemicals group issued an upbeat profit outlook.

At 1600 GMT the rand was trading at 7.27 against the greenback, weaker but not far off its close of 7.2605 on Thursday.

It fell to 7.3210 during the session, a level last tested on September 1, piercing key support at around 7.30. It has broken through two key support areas this week, first at 7.20/23 on Thursday and then moving to test 7.30.

Dealers now say 7.4370, the August 31 high of last year, is the next level to watch on dollar/rand.

The dollar firmed today and there's really no appetite for rand gains at the moment, Christopher Shiells, emerging market analyst at IGM said.

The debt market suffered too.

I think government bonds have sold in unison with rand weakness this week, Steve Arnold, a bond dealer at Investec, said. Another trader said local demand for the longer end of the curve helped to boost the market slightly.

The benchmark 2015 government bond closed at 7.91 percent, from 7.885 on Thursday. The 2026 issue ended the session slightly better at 8.69 percent compared with 8.70 percent on Thursday.

On the bourse, Johannesburg's Top-40 blue-chip index added 0.37 percent to 29,718.96 points, a level last seen on June 9, 2008. The broader All-share index gained 0.33 percent to 32,902.52.

Sasol headed the gainers' list after the world's biggest maker of vehicle fuels from coal said half-year profit likely rose as much as 27 percent.

Shares in the company raced to their highest level since Aug, 2008, ending 5.55 percent higher at 381 rand.

Gold miners also featured on the upside as the weaker rand offset a faltering bullion price. Harmony was up 3.64 percent at 79.80 rand and rival Gold Fields improved 2.6 percent to 117.99 rand.