In what I've read about classical Greece - about Persian wars, Pelaponesian wars, Battle of Leuctra, Macedonia conquest...etc. - military discussion seems to be mostly about the Phalanx with a bit about cavalry. At some point, however, chariots were a very important military advance. Why the decline (if any)? Did this decline take place elsewhere?
I would speculate that chariots weren't used as much on Greek turf due to their lack of maneuverability on hilly terrain. On the plains of Egypt they would have a deadly impact, but try to drag them though hills and orchards, let alone the mountains…
Persians did try to use cavalry, but even that proved to be ineffective, and possibly had cost them defeat at Marathon.
You kind of answered your own question by mentioning the phalanx.
First of all, you will often read some historians saying that chariots were not used by "mountain" people or that the terrain in such-and-such country was not suitable for chariots. This is not true. Macedonia is one of the most mountainous areas in Europe and they were famous for their horses and chariots. Likewise, the idea that Greece did not use chariots is completely untrue, as anyone has read the Iliad knows.
The key factor with chariots is that they are most effective in unorganized fighting when people are spread out. What made chariots obsolete was the adoption of highly disciplined, organized, shoulder-to-shoulder fighting. If you have seen the movie "300" you may remember the scene in which Leonidas gives a lecture on how the Spartan hoplites fight in close formation and lock their shields together, so they fight as a single unit. This kind of tactic in combination with the use of the spear will defeat the use of chariots. Phalanxes are a continuation and advance on this basic tactic.
The Romans never had problems dealing with enemy chariots for exactly the same reason: they fought in highly disciplined, close formations called "centuriae" using rectangular shields that could be joined together to make a tight wall, bristling with spears. Such a formation will easily defend against a chariot.
Another factor in the decline of chariots is the decrease in the use of champions. In many cases chariots were used essentially as battle taxis. A champion would use the chariot to gallup to a place of fighting, kill everybody using a weapon supremacy, then jump in the chariot and ride to the next hotspot. This only is useful if you have champions that have some kind of superior ability and weapons. If the champion is using a bronze broadsword and the average soldiers are using clubs, like in ancient Gaul, then it makes sense. But if every soldier has a good sword, then the champion becomes less important. Thus, economics is a factor too.