In an emergency session, Congress accepted the resignation late Friday and named Vice President Carlos Mesa to replace him, as called for under Bolivia's constitution.
Earlier, as word of the president's impending resignation spread, thousands of miners, students, and Indians crowded the Plaza de San Francisco near the presidential palace, setting off sticks of dynamite and shouting anti-government slogans.
Sanchez de Lozada, 73, submitted his resignation in a letter to Congress, said a presidential aide, speaking on condition of anonymity. Sanchez de Lozada then reportedly left the presidential residence in a helicopter for the western city of Santa Cruz. Radio reports said he would eventually travel to the United States, but that could not be independently confirmed.
The resignation came after thousands of Bolivians marched through La Paz for a fifth straight day Friday, demanding that Sanchez de Lozada step down 14 months into his term. Columns of students, Indians and miners brandishing sticks of dynamite threaded past street barricades, shouting, "We will not stop until he's gone!"
Military planes from Brazil and Peru airlifted hundreds of foreigners stranded in Bolivia since last weekend. For days, the main highway link between La Paz and El Alto airport has been lined with demonstrators clutching rocks and sticks and burning barricades, and commercial flights out of the international airport have been suspended.
"I felt as if I was in the middle of a war and that I would never be able to return to Brazil," said Antonio Vieira, a Brazilian school teacher. "Sometimes I watched out the hotel window and saw bodies, some with their heads shattered."
The popular outrage against the president was sparked by a controversial proposal to export gas to the United States and Mexico through neighboring Chile.
The proposal, which Sanchez de Lozada unveiled in mid-September, tapped deep discord with Bolivia's decade-old free-market experiment, which has failed to narrow the enormous gap between rich and poor in this impoverished country.
The proposal also underscored spreading popular distrust with his administration's U.S.-backed anti-coca growing policies, which have deprived thousands of poor Indian farmers of their livelihood and plunged the president's popularity ratings into the single-digits.
Sanchez de Lozada temporarily suspended the gas export plan last week in the face of riots, which human rights groups said claimed as many as 65 lives. But the demonstrations for his resignation continued.
Late Wednesday, the president sought to defuse the growing crisis with a nationally televised address in which he offered to hold a national referendum vote over the plan. But opponents rejected that offer.
In defending the gas export plan, the president called the gas resources "a gift from God" that would bring millions of dollars annually to a cash-strapped Andean country. But few here believe his claims that average Bolivians, many of whom earn only a few dollars a day, would benefit.
Bolivia, which declared its independence from Spain in 1825, is a majority indigenous country where many speak Spanish haltingly. The country yielded its vast mineral wealth to its colonial rulers
and many see the gas-export project as a return to that legacy.
Opponents also object to the use of Chile, a longtime rival, to export the fuel and argued the US$5 billion project would only benefit wealthy elites.
The president's increasingly fragile coalition suffered a key blow Friday when Manfred Reyes Villa, a key presidential supporter in Congress, said he was quitting the government after weeks of deadly riots between troops and Bolivian Indians armed with sticks.
"I've come to tell him: 'No more,"' Reyes Villa said. "The people don't believe in this government anymore and there is no other option but for him to resign."
On Thursday, presidential spokesman Mauricio Antezana also resigned, and Mesa withdrew his backing earlier in the week.
Reyes Villa's departure left the president isolated as he sought to defuse the crisis in this Andean nation of 8.8 million people, South America's poorest.
A U.S.-educated millionaire, Sanchez de Lozada also served as president from 1993 to 1997. He took office for a second term in August 2002 after narrowly defeating Evo Morales, a radical congressman.