The Arbroath-based group have been in Helmand Province capturing Taleban weapons, protecting roads and destroying heroin and poppy crops.
Nine of their members were killed during operations.
The 50 marines who are returning to RM Condor will be the last of the 800 from 45 Commando who have been serving in Afghanistan since October.
Commanding Officer Lt Col Jim Morris believes it was a tough but worthwhile deployment.
"Opium to the street value of over £20m was found and destroyed as well as the chemicals and equipment to produce it," he said.
"In addition a large number of Taleban weaponry and associated equipment was also destroyed. The operation was an enormous success and local Afghan reactions have been extremely positive.
"There are now eleven schools that have opened since our arrival in Helmand, families are moving back into southern Sangin, the bazaar is thriving and we have secured an area in the centre of the town which is about to receive a new Afghan health clinic, school and government offices."