Former defence secretary Gotabaya Rajapaksa, who oversaw the military defeat of Tamil separatists 10 years ago, and government minister Sajith Premadasa are locked in a close fight, politicians and analysts say.
Rajapaksa has vowed to overhaul national security, playing on the fears of the majority Sinhalese Buddhists following the April suicide bombings claimed by Islamic State that killed more than 250 people.
Premadasa has sought to fire up the countryside with promises of free housing, school uniforms for students and sanitary pads for women - touching on a topic rarely discussed in public anywhere in south Asia but which has drawn women to his rallies.
"For me, national security matters above everything else, after those bomb attacks," said Dammika, a voter in Colombo.
Police said a group of unidentified men opened fire on buses carrying Muslims, to a polling station, in Anuradhapura district in central Sri Lanka. There were no injuries but witnesses said there were tires burning.
Muslims, who make up nearly 10 per cent of Sri Lanka's 22 million population, say they have faced hostility ever since the April attacks.
That division has come on top of long-standing grievances of ethnic Tamils, who say they are still to get justice stemming from the human rights violations during a 26-war civil war with Tamil rebels that ended in 2009.
Long queues of voters formed early in Colombo and elsewhere and six hours into the voting, nearly 60 per cent had cast their votes, said Manjula Gajanayake, the national coordinator at Center for Monitoring Election Violence.
About 16 million people are eligible to vote, with the ballot allowing voters to choose up to three candidates in order of preference.
Votes will be counted soon after polling stations close but the results are not expected before Sunday.
Sri Lanka has become an important arena of influence between regional heavyweights India and China, which has invested billions of dollars in infrastructure as part of its Belt and Road Initiative.
Both the frontrunners for president, Rajapaksa and Premadasa have said they will strive for balance in Sri Lanka's ties with both countries.