* Traders take profits after sterling's recent rally
* Graphic: World FX rates in 2018 http://tmsnrt.rs/2egbfVh
LONDON, Jan 23 (Reuters) - Sterling briefly pushed above the $1.40 mark on Tuesday, extending a rally in which growing optimism about the UK economy and protracted dollar weakness have trumped worries about the terms of Britain's exit from the European Union.
Many investors are also betting that Britain can secure a favourable deal with Brussels to leave the EU, helping to push back a hurdle that has kept in check sterling's recovery.
Since the last week of December, traders have powered a 3.5 percent rally in the pound to its highest level since June, 2016, when Britain voted to leave the EU.
"Sterling is benefiting from the broad dollar weakness story and the recent data has been mildly supportive," said Thomas Flury, head of FX strategies, UBS Wealth Management, Chief Investment Office.
On Tuesday, it rose above the $1.40 level in early Asian trading to a post-Brexit high of $1.4005. On a year-to-date basis, it is the best performing major currency, beating even the euro which is up more than 2 percent in that period thanks to a rapidly improving economy.
At 0745 GMT, sterling was trading at $1.3965 against the dollar. Against the euro, it was broadly flat at 87.73 pence .
Data on Friday showed that speculators on the Chicago futures exchanges increased their net long sterling positions - or bets that it will rise - to the highest level in 3-1/2 years, on the view that Brexit talks had so far gone relatively well and that the UK economy was ticking along better than many had expected.
Currency traders believe the mood in London and Brussels suggests both sides are more amenable to hammering out a transition agreement between Britain and the trading bloc, and then an eventual deal for the terms of departure.
"There is definitely a feeling that Brexit is now far more likely to be 'soft', which underestimates the risk for more problems ahead in our view but for the time being is leading to demand for GBP," said John Marley, head of FX strategy at Infinity International, a currency risk management firm.
With the chance of a "hard" Brexit reduced, the pound has re-anchored itself to UK economic performance and to monetary policy outlook - some traders reckon the Bank of England could tighten faster than expected given stubborn inflationary pressures.
Market expectations are for one more rate hike from the central bank in the latter half of 2018. (Reporting by Saikat Chatterjee and Tommy Wilkes; Editing by Robin Pomeroy)