Bolivians were asked to vote on a change to the country's constitution. Presently, the president and vice-president are limited to two consecutive five-year terms.
Mr Morales, who has been in power since 2006, and his supporters wanted him to be able to run for another term.
With almost all the votes counted, the "No" camp had a narrow but irreversible lead over those favouring another term for Mr Morales.
This means the constitutional ban on serving more than two consecutive five-year terms remains in place.
Despite the constitutional ban on serving more than two consecutive terms, President Evo Morales was allowed to run for a third term in 2014.
The constitutional court argued that the ban did not apply to Mr Morales' initial term because it had taken place before the new constitution came into effect.
Mr Morales will now not be able to stand in presidential elections in 2019.
But he is expected to continue serving out the remainder of his term, which ends in 2020.
When provisional results suggested a win for the "No" campaign, Mr Morales said that "the fight will continue" and his administration would follow through with its plans.
Critics within his party hope he will start training up a potential successor, while opposition politicians see it as a chance to challenge the governing parties.
Mr Morales said he had "lost a battle, but not the war".
There were celebrations in the eastern city of Santa Cruz, an opposition stronghold.
Many opposition politicians and some within Mr Morales's party said the outcome was a victory for democracy.
Former President Carlos Mesa said it showed that "no one is indispensable".
Samuel Doria Medina, who lost three times to Mr Morales in presidential elections said that Bolivia had won.
"They [the government] called this referendum and the people told them 'no'," he tweeted.
Mr Morales won the presidential election with 61% of the vote last year.
There is still widespread support for Mr Morales and his economic programme but many felt a change to the constitution was a step too far.
Some within the ranks of his own party also felt it was time for new, younger politicians to be given a chance to run.
The president's approval ratings were also hurt by recent allegations that he used his influence to favour a Chinese construction firm which employs his former girlfriend.
Mr Morales rejected the allegations and said he had nothing to hide. He ordered an investigation into how the contracts were awarded.
Bolivians voted in a referendum on 21 February to decide whether to allow President Evo Morales to seek another term in office.