Opposition groups accused the government of vote rigging while setting posters of Mwai Kibaki, the president, on fire.
Kibaki trails Raila Odinga, the opposition leader, in the tightest race in Kenya's history.
'We will win'
Both men held rallies in the city, Odinga in Nairobi's sports stadium and Kibaki in the city's main park.
Odinga has promised voters he will develop a new constitution and fight the country's endemic corruption, accusing Kibaki of "dereliction of duty [that] has been most appalling".
Kibaki, who is seeking a second term, has denied the allegations and appealed for a peaceful ballot.
"Let's not beat anybody. We do not have to be violent, let's be peaceful and we will win," he said.
Andrew Simmons, Al Jazeera's correspondent in Kenya, said that Odinga appeared to have captured the popular imagination and appeared to already be celebrating victory, but the election was still too close to call.
"At the centre of all of this is tribalism," he said.
Kibaki has the support of his Kikuyu ethnic community, the largest of Kenya's approximate 40 tribes, and is also popular in the northern and eastern provinces.
Odinga, a former political prisoner, enjoys the backing of his western Luo community, but also has support from other ethnic groups who think the Kikuyus were favoured under Kibaki.
Kenyans fear the closeness of the contest will provoke rigging and more violence in the East African country.
Official results of the presidential and parliamentary polls are expected on Friday morning.