David Cameron promised to "stand together" with Pakistan in the fight against terrorism following talks with his newly-elected counterpart Nawaz Sharif.
The prime minister said the battle required "tough and uncompromising" action but also efforts to combat the roots of extremism and radicalisation.
Cameron also urged Pakistan to co-operate in creating a stable Afghanistan and pledged to go "further and faster" in boosting trade links between the two countries.
Speaking at the Pakistani prime minister's official residence, Cameron said both countries had a shared interest in the "battle against terrorism".
He said: "This is a battle that requires a tough and uncompromising security response.
"But it is also a battle that has to go so much wider.
"Countering extremism and radicalisation, investing in education, tackling poverty, dealing in all the issues that can fuel extremism and radicalisation."
He added: "In this battle the friends of Pakistan are friends of Britain and the enemies of Pakistan are enemies of Britain.
"We will stand together and conduct this fight against extremism and terrorism."
Cameron, the first head of government to visit Sharif since his election last month, said a stable Afghanistan would benefit Pakistan.
He said: "I profoundly believe that a stable, prosperous, peaceful and democratic Afghanistan is in Pakistan's interest, just as a stable, prosperous, peaceful and democratic Pakistan is in Afghanistan's interest."
He told Sharif: "I know you and President (Hamid) Karzai will work together towards those ends."
On business links, the two prime ministers pledged a new target of increasing bilateral trade to £3 billion by 2015, up from the previous commitment of £2.5 billion.
But Cameron said: "I believe there's an opportunity to go further and to go faster and I'm committed to do everything I can to help make that happen."
The prime minister also announced plans to reopen British Council offices in Lahore and Karachi to help strengthen cultural ties.
Sharif said terrorism was a "common threat and a huge global challenge".
"Pakistan has suffered the most in terms of human and financial costs," he said.
"We are therefore resolved to tackle the menace of extremism and terrorism with renewed vigour and the close co-operation of friends."
On Afghanistan he said the peace process should be"inclusive, Afghan-owned and Afghan-led".
He added: "I have assured prime minister Cameron of our shared resolve to seek a peaceful and stable Afghanistan."