The raids came hours after a tourist bus was hit by a roadside bomb near the Giza pyramids.
Police in Egypt have killed dozens of militants during security raids on their hideouts, the interior ministry has said.
The raids killed “40 terrorists” in Giza and North Sinai on Saturday morning, according to a statement from the ministry.
It said the militants were planning a series of attacks on tourist sites, churches and military personnel.
The raids followed Friday’s roadside bomb attack on a tour bus in Giza.
No group has yet said it was behind the blast, which killed three Vietnamese tourists and an Egyptian tour guide, but Islamist militants have targeted tourists in Egypt in the past.
What you need to know about Egypt
Police killed 30 militants during two early morning raids in Giza, while the remaining 10 were killed in El-Arish, the capital of North Sinai province, the interior ministry said.
“A group of terrorists were planning to carry out a series of aggressive attacks targeting state institutions, particularly economic ones, as well as tourism… and Christian places of worship,” the ministry statement said.
It added that police had seized bomb-making materials, ammunition and a large number of weapons during the raids.
Security is already tight in Egypt, with the tourist season at its height and the country’s main Christian minority, the Copts, preparing to celebrate Orthodox Christmas on 7 January.
What do we know of Friday’s attack?
The roadside bomb went off at about 18:15 (16:45 GMT) on Maryoutiya Street in Giza’s Haram district as the bus carrying 14 Vietnamese tourists was passing, according to official accounts.
Four people were killed and eleven others were injured in the incident, which is the first affecting foreign tourists in Egypt in more than a year.
Prime Minister Mostafa Madbouly has said the bus deviated from its planned route without alerting security forces, although the driver has denied this.
How has tourism fared in Egypt in recent years?
It peaked in 2010, when the country saw more than 14 million visitors, but fell sharply after the turmoil of the Arab Spring the following year.
Worse was to come after militants bombed a Russian passenger jet in 2015 as it left Sharm el Sheikh, killing 224 people.
The following year just 5.3 million tourists visited, according to the World Bank.
However, the sector has since recovered and 8.3 million people visited in 2017, the Financial Times reports.
By Africafrique and agencies