He was convicted last year of breaking the Official Secrets and Terrorism Acts, while admitting to fleeing jail under a delivery van.
The 23-year-old had argued he wanted to be like James Bond but claimed to have only passed on fake information.
Judge, Mrs Justice Cheema Grubb says the impact on the community of South West London after his escape, played a part in sentencing.
He evaded capture for three days before he was spotted riding a stolen mountain bike along the canal towpath in Northolt, west London, around 14 miles away.
Khalife, who was a lance corporal in the Royal Signals, was being held on remand accused of using his role in the military to pass secret information to Iranian spies.
He was arrested after telling the British security services he wanted to be a “double agent” and claimed he had cultivated the relationship over more than two years in the national interest.
But he was found guilty of a charge under the Official Secrets Act and another under the Terrorism Act at the end of last year at Woolwich Crown Court, having admitted escaping from lawful custody part-way through his trial.
Commander Dominic Murphy, Head of the Met’s Counter Terrorism Command said: “This sentence reflects the gravity of the offences committed by Khalife. The threat to the UK from states such as Iran is very serious, so for a soldier in the Army to be sharing sensitive military material and information with them is extremely reckless and dangerous.
“I’d like to reiterate my praise to all those who worked on this investigation – those who looked into Khalife’s activity in sharing information with the Iranians, but also the many colleagues from agencies and police forces who assisted us after his escape from prison.
“It was thanks to a combination of fantastic support from the public, along with some brilliant police work that we were able to find and arrest Khalife after his escape and make sure he faced justice.
“This outcome and sentence should serve as a warning to others that the illegal sharing of information in this way will be treated extremely seriously by security services and police, and we will use the full force of the law against those who put the UK’s security at risk.”