Maj-Gen (Rtd) Joseph Nkaissery was laid to rest at his Ilbissil home shortly after 3pm in a ceremony punctuated with calls for peaceful elections.
Speakers praised the Interior Cabinet Secretary for turning around the country's security.
Mr Nkaissery died after a heart attack at his Karen home in Nairobi a week ago, throwing the country into mourning.
His burial at his home in Kajiado Central constituency was attended by top political and military leaders whom he served with at various stages of his life.
President Uhuru Kenyatta, while not directly mentioning the incidents of the last two weeks where top politicians were heckled in public rallies, called for an end to the growing culture of intolerance on both sides of the political divide.
The President spoke out strongly against misuse of social media to spread hate.
He spoke directly to supporters of Jubilee Party which he leads as well as to those who back Opposition leader Raila Odinga, who was also in attendance.
"What we have seen in the last few days has no place in our country, it is not democracy. It should be brought to an end. Abuse, jeering, heckling will not add a single vote to the tally of those you support. Insults on social media will not add anyone a vote," the President said.
He added: "Kenya will remain after August 8. It has to be peaceful, it has to be secure, it has to be united.
That is the legacy Gen Nkaissery would have loved to see. That's what we must give him."
The president recalled that when he needed someone to fix the security sector in 2014, he turned to the CS, then an Opposition MP, because he saw in him someone who always put Kenya's needs first.
Throughout the service, Mr Nkaissery's widow, Hellen, and his four children Angela Soita, Andrew Oitosy, Beatrice Siopot and Kenneth Mumeita listened pensively but gave no speeches, having done so during the requiem mass at Nairobi Baptist Church on Thursday.
Kenya's political and religious leaders turned up in their numbers to see off Mr Nkaissery.
Leaders of the Maa community, including former Tanzanian Prime Minister Edward Lowassa were also present.
Tanzanian President John Magufuli was represented by his security minister Mwigulu Mchemba who told the mourners of how he occasionally consulted Mr Nkaissery on security issues affecting the two countries.
Mr Lowassa urged Kenyans to be proud of their country which he described as being ahead of all other eastern African countries in terms of development.
"Kenya is far ahead economically in the region but you people still say you have not prospered. People in the region yearn to come to Kenya.
What happened in 2008 was shameful and should not happen again," said Mr Lowassa, referring to the 2007-2008 post-election violence.
The former Tanzanian PM praised Mr Nkaissery as a man who cherished peace and stability in Kenya as well as that of the whole of East Africa.
Deputy President William Ruto said he had known Mr Nkaissery since 2002 when they held a public rally in Ilbissil led by retired President Daniel arap Moi.
"It's amazing how a contribution of an individual can make a big difference to a nation. Let us build bridges of friendships among all Kenyans without caring about their background.
That would be a fitting legacy to the General," said the Deputy President.
Mr Odinga said Mr Nkaissery had called to inform him that President Kenyatta had approached him to join the government in 2014.
"And I told him 'you are a professional, if your country needs you, go'. We had our differences but we remained friends till the end," said the Opposition leader.
Chief of Defence Forces Gen Samson Mwathethe spoke fondly of the CS and implored Kenyans to be proud of their country.
Education Cabinet Secretary Fred Matiang'i, who has since been named the acting Interior CS, said the Cabinet had lost a strong pillar.
"We can honour our brother by being honest and by serving with distinction like he did," he told mourners.
The ceremony was devoid of politics that characterises most funerals of politicians.
Having served as the area MP for 12 years, mourners had thronged the grounds next to the CS's house in their thousands.
The highlight of the four-hour ceremony were tributes by Mr Nkaissery's friends and colleagues in the military, Captain (Rtd) Kungu Muigai and Lt Col (Rtd) Francis Mugambi.
Mr Kung'u, President Kenyatta's cousin told mourners how he and the CS had maintained their friendship over the years from the time they joined the military as officer cadets 43 years ago until his death.
"Some of you have always asked what is the relationship between the Kenyatta family and the Maasai community.
Well, the grandmother of Jomo, Mosana, was a Maasai from Nashorua in Narok.
It was in Nashorua that young Jomo was advised by his grandmother to go and hide to avoid being recruited for Second World War. He stayed there for five years and learnt Maa language," he said.
Mr Mugambi recalled his first encounter with Mr Nkaissery at the cadet school, Nakuru, and their time there.
They were such close friends that when Mr Nkaissery was appointed to the Cabinet, he appointed Mr Mugambi as his private assistant and also as a board member of a parastatal in the ministry.
The were also each other's bestman at their weddings.
It was Mr Mugambi that the CS's bodyguards first reached out to on that fateful night when he collapsed in his Karen home and was rushed to the Karen hospital.