The ceremony at the general headquarters was attended by senior government officials‚ army officers and diplomats.
On the occasion‚ a contingent of armed forces presented the farewell guard of honour to Kayani, who retired after serving as the chief of army for six years.
The 57-year-old Sharif, whose elder brother died in the 1971 war with India, was chosen by Prime Minister Nawaz Sharif after several months of speculation.
The appointment of Sharif comes amid tensions on the border with India, Pakistan's fight with Taliban insurgents and increased violence in the country.
Pakistani analysts view Sharif, who will head the 600,000-strong army, as a moderate who sees the militant threat inside Pakistan as just as important as the strategic tussle with India.
Image: Pakistan's outgoing army chief General Ashfaq Kayani hands over the baton of command over to the newly appointed army chief General Raheel Sharif during a ceremony at army headquarters in Rawalpindi ' Photograph: Mian Khursheed/Reuters
Raheel Sharif to succeed Kayani as Pak's new army chief
Change of guard: Gen Kayani leaves army
Why Kayani's exit may halt Pak ceasefire violations
Be VERY cautious: Kayani to Sharif on ties with India
Pak General quits after Nawaz ignores him for army chief post