The victory for Ranil Wickremesinghe also blocks a key step of former president Mahinda Rajapaksa's bid to return to power seven months after he lost the presidency.
Wickremesinghe's centre-right party won 106 of parliament's 225 seats in Monday's general elections, while Rajapaksa's United People's Freedom Alliance secured 95.
The ruling party fell seven seats short of a clear majority, but Wickremesinghe should still be able to control parliament with the support of allies of President Maithripala Sirisena.
"I offer my grateful thanks to all parties and individuals who worked untiringly during the election period to ensure victory for the people," Wickremesinghe, 66, said in a statement.
"Let us together build a civilised society, build a consensual government and create a new country."
Sirisena beat his former ally Rajapaksa in a presidential vote in January and called early parliamentary polls to secure a stronger mandate for reforms.
Rajapaksa was Sri Lanka's president for nine years until his January 8 election defeat.
Rajapaksa was aiming to become prime minister, a position that could eventually elevate him back to the presidency.
He must now be content with being an opposition legislator.