The FTSE 100 <.FTSE> ended up 0.1 percent, while mid-caps <.FTMC> gained 0.8 percent.

Persimmon (>> Persimmon) gained 2.4 percent after a robust trading statement which lifted peers as they absorbed a sign of resilience to pressures on the British consumer.

Persimmon said last month's British parliamentary election had not impacted consumers' demand for new houses, and sales rose 7 percent for the first half.

"All we've had at the moment from the housebuilders is signs that things are going better than expected," said Barry Gibb, research analyst at Beaufort Securities, adding that there was scope for a modest upgrade of estimates by the market in a sector under considerable scrutiny.

"If any of the mainstream housebuilders were to suggest that they are seeing a greater pressure on pricing or reduced level of viewings, it could be taken quite badly by the market," he added.

Housebuilders Barratt Development (>> Barratt Developments) and Taylor Wimpey (>> Taylor Wimpey) also rose on the more optimistic tone struck by Persimmon over the state of demand for houses.

Another top gainer was supermarket chain Tesco (>> Tesco), up 3.8 percent after forecast-beating sales figures from wholesaler Booker (>> Booker Group), which has been under scrutiny from investors since Tesco announced its plan to acquire it.

Gains in Tesco helped the consumer staples sector provide the biggest sectoral boost to the FTSE, adding 9.4 points to the index, while energy stocks weighed as oil prices retreated.

Drugmaker GlaxoSmithKline (>> GlaxoSmithKline) inched 0.2 percent lower after Citigroup cut its rating on the stock to 'neutral' from 'buy, citing slowing HIV market growth.

The broker said risks of a repeal of the U.S. Affordable Care Act could negatively affect volumes and/or price in the HIV treatment market.

South Africa-exposed stocks Old Mutual (>> Old Mutual) and Investec (>> Investec) were a weak spot, down 1.7 and 1 percent respectively, as the rand fell after the South African ruling party proposed at a policy conference to nationalise the central bank and expropriate land without compensation.

But top faller was Worldpay (>> Worldpay Group), which fell 8.8 percent after U.S. credit card processor Vantiv (>> Vantiv Inc) agreed to buy the British payment company for 7.7 billion pounds.

In the previous session the stock soared nearly 30 percent after the company said it had received rival approaches from Vantiv and JPMorgan (>> JP Morgan Chase & Company), which said on Wednesday it did not plan to make a counter bid.

Among mid-caps, construction materials supplier SIG (>> SIG plc) jumped 4.5 percent after it said revenue rose 8.1 percent in the first half, helped by strength in mainland Europe.

"Underlying trading has improved relative to the second half of 2016, with European growth outpacing that of the UK, and good progress has been made on reducing leverage," said Jefferies analysts.

Online grocer Ocado (>> Ocado Group PLC) made more modest gains, up 0.6 percent, as investors seemed to shrug off its first half results, in which it said it expected a recently clinched international deal would be "the first of many".

Ocado shares rose sharply in the aftermath of the Amazon-Whole Foods merger deal amid speculation the company could be the object of a future partnership with the U.S. retail giant as it pushes into food distribution. The company said it had seen a pick-up in interest from U.S. players since the deal.

(Reporting by Helen Reid and Danilo Masoni; Editing by Gareth Jones)

By Helen Reid