The British government has promised to spend an extra £230m on bomb detection, base security, sniffer dogs and other equipment to help protect troops on the frontline in Afghanistan.

The news came as David Cameron arrived in Afghanistan for a Christmas visit to troops serving there, and a day after he confirmed that soldiers would return home from Afghanistan in their thousands next year.

Cameron said improvements in the Afghan security forces would allow the UK to plan for the withdrawal of 3,800 British troops by the end of 2013, leaving just over 5,000 still in the country.

Those who do stay will benefit from extra resources including nearly £30m in additional bomb detectors and another £10m in protecting cars from roadside bombs.

Improvised mines, often made by the Taliban using basic materials like fertiliser and plastic jugs, have been one of the deadliest weapons deployed by the insurgents.

There will also be extra spending on the sniffer dogs that accompany many patrols and can be vital in searching out buried bombs that contain only tiny amounts of metal. This will bring total spending on military explosives-detecting dogs to more than £30m.

The government will also step up spending on security at Camp Bastion, the main base for British troops in Afghanistan, with an extra £5m committed to a patrol system.

The base, roughly the size of Reading, was set up in the middle of the desert in a location so isolated that it seemed almost immune to attack. But a Taliban suicide squad broke in to the base this year and killed two US marines, injured several more, destroyed Harrier jets worth hundreds of millions of pounds and set a fuel depot on fire.

The cash for the extra supplies comes through the urgent operations requirements process, that has funnelled £5.7bn to frontline supplies since 2007. In 2012 the government has used the system to spend £500m on contracts for Foxhound armoured vehicles. They began arriving this year and will continue to be sent to the frontline through 2013 even as the government is bringing older equipment home.

Defence secretary Philip Hammond said this week that the military would not bring everything home from Afghanistan. Some equipment would be left to the Afghans or neighbouring countries, and some equipment would be destroyed.