JOHANNESBURG, April 22 (Reuters) - The South African rand gained on Wednesday after headline consumer inflation edged up as expected last month and retail sales rose, while global uncertainty linked to the Middle East conflict kept markets cautious.

o At 1344 GMT the rand traded at 16.44 against the dollar, up about 0.53% from its previous close.

o South Africa's headline consumer inflation edged up to 3.1% year-on-year in March, from 3.0% in February, statistics agency data showed on Wednesday, in line with estimates from economists.

o Analysts said the increase in inflation would be far larger in April when fuel price hikes triggered by the U.S.-Israeli war on Iran have filtered through into consumer prices.

o South Africa's statistics agency also published retail sales which showed a rise of 1.6% year-on-year in February, from a revised 4.4% increase in January.

o The U.S. dollar was steady and traded near a one-week high as uncertainty over the Middle East persisted despite U.S. President Donald Trump extending indefinitely a ceasefire with Iran.

o Gold prices were higher, supported by some safe-haven demand after Trump's announcement, though it remained unclear whether Iran or U.S. ally Israel would agree to extend the ceasefire.

o On the Johannesburg Stock Exchange, the Top-40 index was down about 0.47%.

o South Africa's benchmark 2035 government bond weakened, as the yield rose 8 basis points to 8.52%.

(Reporting by Sfundo Parakozov and Nilutpal Timsina;Editing by Barbara Lewis)