It comes after the nation had declared victory over the virus in March.
Beijing had essentially eradicated local transmissions until recent days, reporting 137 new cases since last week.
Chinese officials described the situation in Beijing as “extremely grave”.
“This has truly rung an alarm bell for us,” Party Secretary Cai Qi told a meeting of Beijing’s Communist Party Standing Committee.
After a push that began on June 14, the city expected to have tested 700,000 people by the end of Wednesday, Beijing party official Zhang Qiang said.
Around half of them were workers from the city’s food markets, nearby residents and close contacts.
Some 1255 flights to and from Beijing’s two major airports were scrapped by Wednesday morning, around two-thirds of those scheduled.
China also limited other travel around the capital, keying in on hot spots.
On Wednesday, the city of 20 million raised its threat level from 3 to 2, cancelling classes, suspending reopenings and strengthening requirements for social distancing.
China had relaxed many lockdown controls after the Communist Party declared the virus over in March.
Since the virus emerged in China late last year and spread worldwide, there have been more than 8.1 million confirmed cases and at least 443,000 deaths, according to a tally kept by Johns Hopkins University.
Experts say the true toll is much higher, due to the many who died without being tested and other factors.