LONDON (Reuters) - FTSE 100 index closed slightly firmer and near a record high on Wednesday as a rally in housebuilders was offset by a slump in retailers after Next (>> NEXT plc) issued a profit warning.

The bluechip FTSE 100 index <.FTSE> closed 0.17 percent higher at 7,189.74 points, having touched an all-time high of 7,205.45 in the previous session.

Next hit a two-month low and closed 14.4 percent weaker after the retailer cut its profit guidance for the current financial year and warned on the outlook, highlighting "exceptional" levels of uncertainty in the sector.

In its Christmas trading update, Next said its central guidance for the year to January 2017 was for pretax profit of 792 million pounds ($971 million), down from the 805 million pounds it had previously forecast. It also said it expected prices to rise by 5 percent on the pound's plunge after Brexit.

"The fundamental issue is that you've seen a nearly 20 percent trade-weighted depreciation of sterling over the last 12 months," said Jeremy Lawson, chief economist at Standard Life Investments.

"In a sector that imports a very large proportion of the underlying product, that significantly increases the costs in the supply chain."

Peers Marks & Spencer (>> Marks and Spencer Group Plc) and Primark owner Associated British Foods (>> Associated British Foods plc) dropped 6.1 percent and 3.7 percent respectively, while mid-cap Debenhams (>> Debenhams Plc) fell 6.6 percent.

There was a silver lining for the retail sector, however, as mid-cap B&M (>> B&M European Value Retail SA) jumped 9.5 percent after the discount store chain said a record Christmas drove a strong third quarter.

Housebuilders were on a strong footing, with Barratt Developments (>> Barratt Developments Plc), Taylor Wimpey (>> Taylor Wimpey plc) and Persimmon (>> Persimmon plc) rising between 2.8 percent and 4.1 percent, helped by mortgage approvals in November reaching an eight-month high, indicating a post-Brexit recovery.

A positive note from Deutsche Bank also helped the sector. The bank said it saw close to 30 percent upside across the housebuilding sector as a whole. Housebuilders <.TRXFLDGBHBLD> lost more than 20 percent in 2016.

"After a tumultuous 2016, we see appealing value in the UK housebuilder sector. While investor appetite for UK-focused stocks remains more moderated reflecting Brexit risk, we see dividend yield as difficult to ignore," analysts at Deutsche Bank said.

Taylor Wimpey and Barratt Development have trading updates on Jan. 11 and 12 respectively.

(Editing by Mark Trevelyan)

By Helen Reid and Kit Rees