Pope Francis is closing the event with a mass on Brazil's Copacabana beach.
Many of the pilgrims had slept on the beach after attending an all-night vigil, which the Pope also led.
Sunday's ceremony marks the end of his first foreign trip since becoming pontiff in March.