The three great pyramids of Giza were built just within one century of each other from 2590-2500 BC, in the Old Kingdom. As far as I understand it (and it goes without saying, please correct me if I'm wrong), the next generations also built pyramids to some extent, but those weren't as large or as well built, so that many fell into ruins.
The most powerful pharaos of the Middle and New Kingdom didn't even built any large tombs at all, instead ultimately preferring to be buried far away from anybody, in a hidden valley (the Valley of the Kings).
What are the reasons for this change? Were they economical, that pyramids were simply too expensive? Or were there religious reasons? Or something else entirely?
I can't give an answer directly, but I think it is useful to note that massive pyramids, while certainly the most famous monuments of Egypt, shouldn't be thought of as Egyptian in general. While pyramids were built through the Middle Kingdom, the major ones you have heard of were all built in the fourth and, to a much lesser extent, third dynasty. So really they are a product of a particular moment in Egyptian history.
A pyramid isn't just a pyramid, but an entire pyramid complex. There's smaller buildings and temples, a queens pyramid, a canal system, an infrastructure to feed and shelter everyone. Then there are even more temples, statues, and burial chambers. It becomes exceedingly expensive and, especially at Giza, land became a premium as the space was filled in quickly. The smallest of the three had less land to work with, but was also the most expensive due to building materials.
Over time, tastes changed, the pyramids were being built smaller and smaller until other styles emerged. The problem of tomb robbing was also another issue and the valley of the kings became an alternative as well as security also became an issue.
I don't think a definite reason/answer is known, but there are some clues.
A research published in "geology" magazine by Christopher Bernhardt, USGS; Benjamin Horton, Penn; and Jean-Daniel Stanley, Smithsonian Institution shows evidence for a massive drought around the end of the old kingdom (which seems to be part of a world wide event around 2200BCE). This is also seen in digs in other Egyptian places where deserted villages and encroaching sands are visible in the Nile delta and various oases. This without a doubt had its effect on the economy and available materials and workers, which might have made building pyramids too expensive.
http://www.upenn.edu/pennnews/current/2012-08-30/latest-news/fossilized-pollen-reveals-evidence-egyptian-drought (Showing the evidence for the drought) http://www.gizapyramids.org/pdf_library/hassan_fs_oconnor.pdf (More information and sources about the effect of that drought on the "old kingdom")
The thesis put forward by John Romer in A History of Ancient Egypt is basically this: The core of skilled craftsmen, stone workers etc existed and grew before pyramids were built, they made vases pots etc. (Bavarian pottery c.4400 BCE onwards) As power became more centralised within Egypt, the kings employed more and more of these craftsmen as the central core of a building program that used increasing numbers of the unskilled population to build bigger and bigger pyramids. The more that power centralized in the hands of each successive king, the greater the resources they had at their disposal, and the greater the knowledge of pyramid builders became. When internal political changes caused a diffusion of power within Egypt (mid 3rd century), individual kings could no longer command such a large share of the resources of Egypt to complete their projects. Those same resources were used to create more varied projects that reflected the diffusion of power amongst others within Egypt. In other words the centralization of power was reflected by the great pyramids.