The prime minister met Afghan President Hamid Karzai on Monday
Gordon Brown has outlined a new strategy for Afghanistan and Pakistan, saying co-ordinated action is needed to tackle terrorist threats there.
Mr Brown said the border area between the two countries was "a breeding ground" for terrorists and provided a direct threat to British security.
A further 700 troops will be sent to Afghanistan for a short period to boost security for elections there in August.
Opposition parties said the UK's Afghan goals must be more clearly defined.
The Conservatives said its objectives needed to be "hard-headed and realistic", focused squarely on enhancing security and disrupting terrorist training camps.
The Lib Dems said public support for the UK's mission in Afghanistan was under strain and economic support was just as important to boosting security as military activity.
'Chain of terror'
Mr Brown's statement came hours after a British soldier was killed in southern Afghanistan.
The soldier, who was serving with the 1st Battalion Welsh Guards died on Tuesday in an explosion while on foot patrol near Gereshk in Helmand Province.
Mr Brown, who recently returned from a visit to the two countries, said Pakistan must be part of a solution to Afghanistan's problems as there was a "chain of terror" linking the border area between the two countries to the UK.
"These border areas between Pakistan and Afghanistan are the breeding ground, the crucible of terrorism," Mr Brown said.
"Our approach to (Afghanistan and Pakistan) is different but must be complementary."
He said there was clear connection between elements of the Taleban operating in both countries and Al-Qaeda.
He promised extra funding to help Pakistan with counter-terrorism operations as well as education and economic assistance, pledging £665m over the next four years.
One of the primary aims of UK support would be to "stop young people falling under the sway of violent extremists", with £125m promised for schemes on education and values.
On Afghanistan, the prime minister said 700 more troops would be sent to provide security at the forthcoming presidential election - boosting the UK's total troop presence to 9,000.
After the election, troop numbers would return to 8,300.
Mr Brown said long-term stability and the growth of democracy could be the "only winners" in Afghanistan.
'Isolate and remove'
The emphasis of UK operations in Afghanistan would increasingly shift from frontline operations in the south of the country to training the Afghan army and police force, he said.
As this happened, the PM said he hoped control of individual provinces could gradually be handed over to Afghan control as had happened in Iraq.
He pledged an extra £500m in financial and other development aid to tackle poverty in Afghanistan over the next four years and "urged" the Afghan government to tackle corruption.
The goal of the Afghan government and Nato mission in the country was to "divert, isolate and remove insurgents" and to give ordinary people an economic stake in the future.
Conservative leader David Cameron welcomed the increased financial aid for Pakistan but said it should be linked to the country's performance in tackling terrorism.
"Terrorism and extremism must be confronted but we must do so by working with the Pakistan government to help them deal with the mortal threat they face," he said.
Lib Dem leader Nick Clegg said it was "right" to develop an over-arching strategy for both countries.
However, he questioned the resources available to British troops in Afghanistan and also pressed the PM to outline the criteria for an eventual "exit strategy".
"The long-term stability of Afghanistan can only be achieved if we can secure the country's economic and social development."
The government's new so-called "Af-Pak" solution echoes US President Obama's new policy unveiled in March.
During his trip to the two countries, Mr Brown said efforts to defeat international terrorism had to be made in Afghanistan's Helmand Province and neighbouring Pakistan.
Three-quarters of terrorist activity in Britain originates from the border area between Afghanistan and Pakistan, he said.
Earlier former Lib Dem leader Lord Ashdown, said the UK and other Nato countries had failed to achieve their objectives in Afghanistan and risked the same outcome in Pakistan.
"The time to turn this round is diminishing and diminishing fast," he told BBC Radio 4's Today programme.
The peer, who served as the UN's High Representative and EU envoy to Bosnia from 2002 to 2005, was last year blocked from being UN envoy to Afghanistan by President Hamid Karzai.
He said the UK needed to "reduce its ambitions" for political and social change in the region, focusing instead on preventing terrorists from using them as a base to plan attacks overseas.