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.
People in the United Kingdom will vote on whether to remain in the European Union on 23 June.
Leave EU campaigners reacted angrily to his words, with Tory MP Dominic Raab dubbing him a "lame duck" president.
UK Independence Party (UKIP) leader Nigel Farage said Mr Obama would not be in office "by the time we're out of the EU post-referendum" and trade deals would be in both countries' interests.
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.
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."
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".
The Duke and Duchess of Cambridge and Prince Harry will welcome the Obamas for dinner at Kensington Palace on Friday evening.
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.
"America wants Britain's influence to grow, including within Europe."