US President Barack Obama has said Britain would go to the "back of the queue" for trade deals with the US if it votes to leave the European Union.
He said Britain was at its best when "helping to lead" a strong EU and membership made it a "bigger player" on the world stage.
He was speaking at the start of a three day visit to the UK.
EU exit campaigners reacted angrily to his words, with Tory MP Dominic Raab dubbing him a "lame duck" president.
Mr Raab told BBC News: "The reality is the US has failed and Barack Obama's biggest trade failure has been in not being able to secure a trade deal with the EU.
"I think those left to pick up the pieces after Obama moves on will be a little bit frustrated about his comments because they don't reflect US trade policy and I'm sure they won't reflect future US trade policy. What you had here was a lame-duck American president doing an old British friend a political favour."
Speaking at a joint press conference with Mr Obama, Prime Minister David Cameron said being a member of the EU strengthened Britain's "special relationship".
On the UK's upcoming referendum on its EU membership, he said: "This is our choice - nobody else's - the sovereign choice of the British people - but as we make that choice, it surely makes sense to listen to what our friends think."
Mr Obama said: "The UK is at its best when it's helping to lead a strong European Union. It leverages UK power to be part of the EU. I don't think the EU moderates British influence in the world, it magnifies it.
"America wants Britain's influence to grow, including within Europe."
On whether he should be intervening on the UK's referendum, he said: "Let me be clear: ultimately this is something the British voters have to decide for themselves.
"As part of our special relationship, part of being friends is to be honest and to let you know what I think, and speaking honestly, the outcome of that decision is a matter of deep interest to the US, because it affects our prosperity as well."
The Obamas were welcomed in the evening by the Duke and Duchess of Cambridge and Prince Harry for dinner at Kensington Palace.
Earlier, the US president and his wife Michelle had lunch with the Queen and Duke of Edinburgh, and paid tribute to Her Majesty on her 90th birthday, describing her as "truly one of my favourite people".
EU referendum: In depth
Mr Obama's intervention into the EU referendum debate has been criticised as "hypocritical" by London Mayor and EU leave campaigner Boris Johnson, and UKIP leader Nigel Farage said he was the most anti-British US president ever.
Mr Johnson said that although he was a "big fan" of Mr Obama, remaining in the EU is "clearly something we have a disagreement on".
The London mayor has been under fire over comments he made about Mr Obama's "part-Kenyan" ancestry in an article for the Sun, suggesting some people thought he had an "ancestral dislike of the British Empire".
Mr Johnson highlighted the way a bust of Winston Churchill had been removed from the Oval Office after he became president.
The US president hit back at the suggestion that he was not an admirer of Britain's wartime leader, saying he had a bust of Churchill outside the Treaty Room - his private office on the second floor of his official residence.
"It's there voluntarily because I can do anything on the second floor. I love the guy," he said.
He did not refer to Mr Johnson by name, but added: "That's just on Winston Churchill. I think people should know that, know my thinking there."
UKIP leader Nigel Farage earlier told BBC News he thought Mr Obama's views on the UK had been shaped by his Kenyan grandfather's experience of colonial Britain and suggested he bears a grudge against Britain.