Organisers estimated 40,000 people gathered to hear Anwar's first public speech in the capital, Kuala Lumpur, since last month's general elections.
Police said the number was closer to 4,000.
"We are just waiting for the right time. We want to create a new era for Malaysia," Anwar said to applause from the crowd.
"We will hand over the parliamentary opposition post to Prime Minister Abdullah Ahmad Badawi."
Police halted Anwar an hour into his speech and the crowd dispersed peacefully.
Police said the rally was illegal because it did not have a permit required by Malaysian law for all public assemblies of more than five people, and had urged people to stay away.
Officially Malaysia's opposition coalition has 82 seats in the 222-member parliament but unofficially has enough parliamentary members to form a government, Anwar said before police surrounded the rostrum where he was speaking.
Anwar himself will be able to run for political office again on April 15, after the five-year ban imposed following a conviction for corruption, expires.
He was cast into the political wilderness after being dropped in 1998 by Mahathir Mohamad, Malaysia's former prime minister and, originally, a mentor of Anwar's.
But, as the ban comes to an end, his political fortunes have also been revived by the opposition's gains in last month's general elections.
For the first time in 40 years, the opposition prevented the ruling Barisan Nasional coalition from taking a two-thirds parliamentary majority and seized control of five states.
Barisan's poor showing sparked some calls for Abdullah Badawi, the current prime minister, to resign, although he has refused to step down.