With almost all ballots counted, the governing centre-left coalition is marginally ahead of its centre-right Alliance rivals, with around 40 percent each.
The Sweden Democrats, which has roots in a neo-Nazi movement but has worked to soften its image, won 17.6 percent, up from 13 percent in 2014, for a third-place finish.
The scenario of a bipartisan coalition is highly uncertain. However, the results were closer to one in six.
Rising support for the party has mimicked the drift in other European nations, where mass migration in the continent increased during the height of the Syrian civil war in 2015.
"This government has run its course..."
And whoever wins, the rise of populist, nationalist and anti-immigrant parties is changing Europe's political landscape, with centrists adopting far-right language and policies to defend their vote. Still, they succeeded in defining the election's agenda and expanded their power in parliament.
Lofven, whose minority government made up of the Social Democrats and the Greens with the informal support of the ex-communist Left Party, has managed to hang onto power by sealing deals with the right-wing on energy and migration, among other things.
Jimmie Åkesson, the Sweden Democrats leader, has already spoken of his willingness to play a role in a government collaboration with the Conservatives and the Christian Democrats.
The four-party Alliance has so far rejected his offer, urging him to step down and make way for them to form a government.
"I believe that it must be the largest party in Sweden that forms a government".
In the end, the Sweden Democrats were beaten by Prime Minister Stefan Lofven's Social Democrats by a 10 percentage point margin and eclipsed also by the Moderates of Ulf Kristersson, the Alliance's candidate for the premiership.
He added: "It is clear that a cross-bloc coalition is needed to govern".
Mr Lofven's bloc holds 144 seats and the Alliance holds one less.
"It's expected", Karin Kangas, 52, who voted for the Social Democrats, said of the confused parliamentary picture. Meanwhile, next-door in Finland, the populist True Finns party was included in the center-right government in 2016. One option could be for one of the parties to switch alliances.
Lofven met Monday with his party leadership to map out a way forward.
With few other realistic paths open for a new government to be formed, this would leave the country heading for political deadlock. Prime Minister Stefan Lofven said he meant to remain in the post though, AP reported. Both the left-leaning bloc led by the Social Democrats and the centre-right bloc have said they would refuse to consider the Sweden Democrats as a potential coalition partner.
In particular, the governing Social Democratic Party seems to have had its worst electoral performance in a century.
The potential of a surge by the party had many Swedes anxious about an erosion of the humanitarian values that have always been a foundation of their country's identity.
The day before voting, Social Democrats leader Jimmie Akesson claimed the prime minister was prioritising the needs of new immigrants over those of Swedish citizens.
If he is forced to stand down, parliament would be dissolved and fresh coalition attempts would start in September.
At the same time, the SD is a one-issue movement, nearly exclusively focusing on immigration - and demanding a much stricter approach to it.
Traditionally appealing to working-class men, it wants to attract more women and higher-income voters. "Everything is about us", Akesson said.
There was a sense of relief among supporters of mainstream parties about the far-right's less dramatic gains.
The influx of 163,000 asylum-seekers in Sweden in 2015 has polarized voters and fractured a cozy political consensus.
Sweden's traditional parties have since hardened their tone to reflect concerns about integration. Most notably, he's been an outspoken critic of the rising number of immigrants in Sweden.