Crossing into or out of Bolivia from Corumbá is a slightly disjointed procedure. Leaving Brazil, you should get an exit stamp from the Polícia Federal at Praça da República 51 in Corumbá (easiest before 11am or between 7pm and 9pm), before picking up a Bolivian visa (if you need one) from the consulate at Rua Antônio Maria Coelho 881 (t 67/3231-5605). After that, it’s a matter of taking the bus (from the Praça Independência on Rua Dom Aquino Corréa) for the 10km to the border, checking through Bolivian immigration and receiving your passport entry stamp. Money can be changed at decent rates at the border.
Train tickets for Santa Cruz should be bought at La Brasilena train station in Quijarro, a few minutes by colectivo (a type of shuttle bus; R$5) or bus from the Bolivian immigration office. First class to Santa Cruz costs R$70, second class R$40. The first-class carriages are comfortable, with videos, but everything sways and the toilets are dirty. Limited food is available on board, and also from the trackside villages during the train’s frequent stops. Insect repellent and clothes that cover your flesh are essential, as the lights of the carriages attract all manner of biting insects at night. Drinking water and a torch are also useful. As timetables vary considerably, check at the station in Corumbá or Quijarro at least a couple of days in advance. It’s worth going to Quijarro the day before departure to actually make your booking.
Entering Brazil from Bolivia is essentially the same procedure in reverse, although US citizens should remember to pick up visas in the Brazilian consulate in Santa Cruz before leaving.