The city government said residents should avoid "non-essential travel" out of the capital.
"Anyone leaving Beijing must have a negative reading on a nucleic acid test taken within seven days (prior to departure)," Chen Bei, deputy secretary-general of Beijing municipal government, said at a press conference.
Residents of "medium- or high-risk" areas of infection are completely banned from leaving.
Non-residents and outside vehicles are prohibited from entering communities and villages in medium and high risk areas, Chen said.
He added that the higher risk residential areas are "fully enclosed and controlled" - similar to strict local measures imposed in Wuhan at the height of the pandemic.
The local education commission announced that all schools, which had mostly reopened, would close again and return to online classes. Universities were told to suspend the return of students.
"The epidemic situation in the capital is extremely severe," Beijing city spokesman Xu Hejian warned at a press conference.
Another 27 cases were reported on Tuesday.
They took the number of confirmed infections in Beijing over the past five days to 106, as authorities locked down almost 30 communities in the city and tested tens of thousands of people.
Trace and test
Officials in the city said they would test stall owners and managers at all of its food markets, restaurants and government canteens.
Beijing's testing capacity has been expanded to 90,000 a day, according to state news agency Xinhua.
Retiree Wu Yaling, 57, was in a long queue of masked people waiting in the scorching heat for tests at a park opposite one city-centre hospital.
"I try not to go out as much as possible," she said, adding that her home is near one of the closed markets.
On Tuesday, the capital's transport commission banned taxi- and ride-hailing services from carrying passengers out of the city, Xinhua said.
Companies were told to encourage flexible work arrangements such as teleworking, while libraries, museums, art galleries and parks must now limit capacity to 30 percent.
All indoor sports and entertainment venues in Beijing were ordered to shut on Monday, while some other cities across China warned they would quarantine arrivals from the capital.
Authorities also reported four new domestic infections in neighbouring Hebei province, while a case reported in Sichuan province was linked to the Beijing cluster.
Officials were racing to track people from Beijing who had travelled to other parts of China, and encouraging those who visited the capital to get tested.
Beijing officials closed 11 markets and disinfected 276 agricultural markets and 33,000 food and beverage businesses.
Seven more residential estates were also locked down on Tuesday.
"Beijing's outbreak will probably be controlled quite quickly," said Wu Hulin, a 23-year-old tech worker in Xicheng district who got tested.
"I think (China) is doing a better job compared to overseas."
Officials had warned that, since May 30, 200,000 people had visited Xinfadi market, which supplies more than 70 percent of Beijing's fruit and vegetables.
More than 8,000 workers there had been tested and sent for quarantine.
Until the new outbreak, most of China's recent cases were nationals returning as COVID-19 spread globally.
China's Center for Disease Control and Prevention said Monday the virus type found in the Beijing outbreak was a "major epidemic strain" in Europe.
People in Australia must stay at least 1.5 metres away from others. Check your state’s restrictions on gathering limits.
Testing for coronavirus is now widely available across Australia. If you are experiencing cold or flu symptoms, arrange a test by calling your doctor or contact the Coronavirus Health Information Hotline on 1800 020 080.
The federal government's coronavirus tracing app COVIDSafe is available for download from your phone's app store. SBS is committed to informing Australia’s diverse communities about the latest COVID-19 developments.