In the Old Kingdom, the Egyptians built pyramids to serve as tombs for their pharaohs. In the Middle Kingdom, they dug in the cliffs in the Valley of the Kings. What is the reason for them changing from pyramid-building to placing their tombs in this valley?
Pyramid-building declined (in size and quality) during the 5th and 6th dynasties (c. 2450 to 2175 BC) of the Old Kingdom after reaching a peak during the 4th dynasty (c. 2575 to 2450 BC). We don't know for certain why this decline happened, but the economic cost of such large projects and a lessening of central authority were probably the main factors. Also, after the 4th dynasty, there was an emphasis on sun temples and thus fewer resources available for pyramids.
Although pyramids on the scale of the two largest at Giza were never again realised, a number of Middle Kingdom 12th dynasty pharaohs (c. 1991 to 1802 BC) did build pyramids larger than most of those of the 5th and 6th dynasties, though not on the scale of those of the largest of the 4th dynasty. Pyramids again fell out of favour with New Kingdom (c. 1539 to 1069 BC) pharaohs. It has been argued that the abandonment of pyramid-building by the New Kingdom pharaohs was because of a desire to better conceal their tombs from grave robbers (with ultimately minimal success) and / or because of the change in funerary practices which came with the new dynasty's principal deity.
A. R. David in The Pyramid Builders of Ancient Egypt notes the importance of stability, prosperity and central authority in the Old Kingdom (3rd to 6th dynasties, c.2575 - c.2175). Pyramid-building meant that
the drain on the resources of the country was considerable. Not only did the pyramids and their complexes have to be built, but the altars in the mortuary temples of the kings had to be continuously replenished with food and other offerings, in perpetuity. The king’s bounty also extended to his favoured courtiers; he gave them their tombs and an ‘eternal’ food supply for their associated chapels, to ensure the satisfaction of their souls. Before long, the royal coffers were depleted.
Because of this, and also because of the rising importance of the sun-god, Rec, to whose priesthood the impoverished kings were becoming increasingly subordinate, the pyramids of the 5th and 6th Dynasties suffered a lessening of standards. Although they conform to the same regular pattern, these pyramids were constructed of inferior materials, with brick or rubble cores instead of stone. It was the new solar temples of the 5th Dynasty which now benefited from the major direction of royal resources. Indeed the method of construction of the pyramids provides a fair indication of the economic prosperity of Egypt and of the power of the king.
Toby Wilkinson, in The Rise and Fall of Ancient Egypt, also emphasizes costs:
Three generations of huge investments - human, material and administrative - in pyramid-building transformed Egypt but proved an unsubstainable drain on its resources. Khafra's successor, Menkaura, was the last king to build a pyramid at Giza and it was on a much reduced scale...only one tenth the volume of the Great Pyramid.
The 4th dynasty pyramids of Sneferu (two pyramids of over 1 million cu.m, at Dashur), Khufu (over 2.5 million cu.m, at Giza) and Khafra (over 2.2 million cu.m, at Giza) dwarf all those that came after them. The third pyramid at Giza (Menkaure, last pharaoh of the 4th dynasty) is only 235,183 cu.m, but it at least matches the quality of the bigger ones. On the decline in size and quality of the 5th and 6th dynasty pyramids,
kings of this era drastically reduced resources directed to pyramid building from the Fourth Dynasty. Instead, they diverted some resources to sun temples dedicated to the god, Re. The meaning of these trends must be inferred without much help from other kinds of evidence. In general, Egyptologists believe that kings now directed more resources toward temples for the god Re and away from their own pyramid complexes because the kings themselves had lost status in their society in comparison with Fourth-dynasty kings.
Source: E. Bleiberg (ed), 'Arts and Humanities through the Eras: Ancient Egypt 2675 - 332 B.C.E'
The Old Kingdom was followed by a period of political division and instability (First Intermediate Period) during which only a handful of minor pyramids were built. Then came the Middle Kingdom (11th to 13th dynasties, c.2010 - c.1630) which peaked during the 12th dynasty, and pyramid-building returned, albeit on a smaller scale than that of the 4th dynasty. Priorities, it seems had changed, as had resources:
The position of kingship had changed, and confidence in the massiveness of tombs as a means of ensuring the continuance of eternal existence had been shaken by the political upheavals of the First Intermediate Period; also social changes had occurred that meant the labour resources of the entire country were no longer at the disposal of the Twelfth Dynasty kings.
Pyramid building declined further during the 13th dynasty, no doubt in part because of the large number pharaohs with short reigns. The Middle Kingdom was, in turn, followed by another period of increased instability and division (Second Intermediate Period). Again, economic decline and political instability coincided with the abandonment of pyramid-building.
Another problem was grave robbery; pyramids were a rather obvious target, as were mastabas, and difficult-to-guard tombs in mountainsides were little better:
It was no secret that, as the burial process grew more elaborate, so did the value of the grave goods interred with both royal and non-royal mummies. Gilded coffins, amulets of precious stones, exotic imported artifacts all proved too tempting for thieves. When embalmers began to include protective amulets, precious stones, gold, or silver within the mummy wrappings, even the deceased’s corpse came under threat. Robbers probably attacked royal tombs soon after the king’s funeral, and there is evidence of corruption among the necropolis employees charged with protecting the tombs.
Source: David P. Silverman cited in 'Tomb Robbing in Ancient Egypt'
The above article continues:
By the time of the New Kingdom of Egypt (c. 1570 - c. 1069 BCE) the problem had grown so severe that Amenhotep I (c. 1541-1520 BCE) commissioned a special village to be constructed near Thebes with easy access to a new royal necropolis, which would be more secure. This new burial place is known today as the Valley of the Kings and the nearby Valley of the Queens and the village is Deir el-Medina. They were located outside of Thebes in the desert – far from easy access – and the village was intentionally isolated from the Theban community at large, but even these measures would not be enough to protect the tombs.
It has also been argued that the New Kingdom abandonment of pyramids in favour of "rock-cut tombs" was due to the Theban origin of the 18th dynasty (c. 1539 to 1292) and their principal diety, Amun (or Amen, Amon). In Egypt: How a Lost Civilization was Rediscovered by Joyce Tyldesley, the author writes:
Amen,...was now revealed to all as Egypt's principal deity,... This change in allegiance was marked by a revolution in funerary traditions. Pyramids, strongly associated with the northern sun cult of Re, were not entirely suitable for the burial of Theban kings. Instead, the New Kingdom monarchs would be interred in secret rock-cut tombs carved deep into the Theban mountain.