LONDON- Sterling gained on Thursday, boosted by better-than-expected retail sales and news that Britain's opposition Labour Party had begun its bid to bring down Prime Minister Boris Johnson and stop him taking him out of the European Union without a deal.

Higher July inflation, posted on Wednesday, also contributed to investor optimism.

Market participants have also been trimming their expectations of further weakness in the pound, judging by prices in the derivatives market.

However, analysts say it is unlikely that sterling will rise much further given the risk of Britain crashing out of the European Union without a divorce agreement at the end of October.

Retail sales rose by 0.2% month-on-month in July, a smaller increase than in June, when they rose by 0.9%, but higher than a Reuters poll was forecasting, which was a 0.2% fall. The month-on-month increase in June was revised down from 1%. Year-on-year sales went up by 3.3% compared with a 3.8% rise in the previous month.

Marshall Gittler, chief strategist at ACLS Global, said the slowdown in sales "suggests to me that consumers are getting nervous ahead of Brexit", adding that this should be negative for the pound.

This week inflation rose unexpectedly to 2.1% in July, which could have prompted the Bank of England to signal interest rate rises, but this time it "will likely prove insufficient to support the pound much above the 1.2050 level", said Fritz Louw, a currency analyst at MUFG.

But higher than expected retail sales and above-target inflation data did not make an impact on the fixed income market, with bond traders still expecting to gain more yield from short-dated British government bonds than from long-term Gilts, a signal that a recession may be coming.

The Gilt yield curve remained inverted on Thursday - which means short-dated Gilts offer bigger returns than their long-dated counterparts - as the 30-year yields fell below 1% and the 10-year yields were at record low around 0.4%.

The pound was last up by 0.7% at $1.2136 GBP=D3 , having briefly touched a one-week high of $1.2150, but it remains not far from the 31-month low of $1.2015 it reached on Monday.

Against the euro , the pound was up by 0.6% at 92.14 pence, after falling to 92.50, its lowest since Aug. 6. This week it has plunged to a 10-year low of 93.26 pence against the common currency.

The cost of protection against unexpected moves in the currency, seen in the three-month options pricing, eased a bit from a seven-month high. Three-month risk reversals, which encapsulate the Brexit deadline, paint a similar picture.

The small uptick came from the news that opposition leader Jeremy Corbyn has started to gather support for a vote of no-confidence in the current government. 

This was seen by some investors as confirmation that parliament is ready to do all it can to avert a no-deal Brexit.

Johnson has promised to take Britain out of the European Union by Oct. 31, with or without a deal, setting the scene for a showdown in parliament, where lawmakers are opposed to a divorce without a transition agreement.

(Reporting by Olga Cotaga Editing by Frances Kerry) ((olga.cotaga@thomsonreuters.com))