Latin America's poorest nation has been paralysed by strike action for weeks. Workers around the country have been calling on Sanchez de Lozada to step down over controversial plans to privatise gas exploration.
At least 65 people have died in violent clashes between protesters and police.
Bolivian farmers have also been protesting over a US-backed initiative to stem cultivation of coca, which is used to produce cocaine.
"My resignation, which I submit to Congress, should be sufficient to resolve the nation's problems and while I fervently hope that is so, I fear the solution is not so simple," read the letter sent by Sanchez de Lozada to lawmakers on Friday.
His replacement, Mesa, is a respected journalist and political independent.
Tens of thousands of people marched through Bolivia's administrative capital, La Paz, on Friday calling on the president to go. Earlier, a chief coalition partner of the embattled president withdrew its support for the government.
A policeman hits a protester with
his rifle butt amid recent riots
“There's nothing left to do but leave (the government),” Manfred Reyes Villa, head of the centre-right New Republican Force (NFR) said.
“This can't go on,” he added, according to the BBC.
The news was widely welcomed, with people dancing and clapping in the streets and singing the national anthem. "Finally, the criminal has fallen!" said Roberto de la Cruz, a union leader.
Sanchez de Lozada, a 73-year-old US-educated businessman and one of the wealthiest people in the country, was disliked by millions of Bolivians who saw him as an out of touch “gringo”.
He was elected last year by Congress after garnering less than a quarter of the popular vote.
The growing political muscle of socialist movements in Bolivia extends a shift toward the left across South America, where new leaders in Brazil, Venezuela and Argentina have queried the benefits of US-brokered free market reforms.
Opposition and protest leader Evo Morales, speaking to the BBC, hailed an earlier reports of the president's likely resignation as a triumph.
Morales said protesters in neighbouring El Alto had over-run the airport in an attempt to prevent Sanchez de Lozada from leaving the country. It was impossible to confirm this information.
Demonstrators attacked police
with slingshots in street battles
Morales said the protests, which began after news that the country planned to sell off natural gas resources, would now end.
Meanwhile, the US military said it planned to send a team of security specialists to the American embassy in Bolivia to assess the situation in the country.
Friday's demonstration in La Paz was one of the biggest protests since the crisis over the gas exports began more than a month ago, with around 50,000 people taking part.
These included indigenous groups, farmers, workers and miners.
The protests left much of La Paz crippled after weeks of blockades. There is little food or fuel, pharmacies are running out of basic medicines and there is no money in cash machines, Reuters has reported.
Thousands of protesters crowded
Plaza San Francisco in La Paz
The Bolivian president had already been forced to postpone the controversial gas export scheme until 31 December.
The government estimated that revenues from the gas exports to the US and Mexico would generate about $1.5 billion a year and give the decrepit economy a huge boost.
But union leaders and the nation's poor Indian majority, which has frequently led protests against government attempts to privatize the country's state industries, argue the economic benefits will not reach them.
The opposition rejected Sanchez de Lozada's offer of a referendum on the project, saying it would accept nothing less than his resignation.
Mesa will serve as President until 2007 when Sanchez de Lozada's term was due to expire.