The Ptolemies managed to do pretty well for themselves for quite a while. However, there were a couple of long term factors that slowly sapped their strength even before the Romans enter the picture.
1) Unlike the Seleucids, the Ptolemies were the rulers of a kingdom, not an Empire. It was a fabulously rich, highly populated and easily defensible kingdom, but this is still the resources of a powerful kingdom and not that of a powerful Empire. They did possess external territory in Lycia, Thrace, Cyprus, and parts of the Levant, but this never really got to the Imperial level. By comparison, the Seleucids have a tonne of resources at their disposal, particularly since they had a huge urbanisation program and local development policies. By the 190s BC it's clear that the long struggle between the Ptolemies and Seleucids had been won by the Seleucids, and only the Romans managed to upset this balance.
2) The Ptolemies initially relied upon their Macedonian and Greek settlers for military strength, but so much of this was spent fighting the Seleucids and other Diadochii states that they ended up needing to teach phalanx-formation fighting to native Egyptians. My argument is that they should have done this far earlier, why on earth limit your military manpower in one of the most densely populated regions of ancient times? It ended up eroding the strength of the elite which the Ptolemies partially relied upon to maintain control.
And then of course there's the fact that Egypt will ever be highly attractive. The Romans were drawn to it by its huge grain supplies well before they were drawn to its wealth. This means that aggressive Mediterranean Empires with interests in the East will almost always seek to control Egypt, so if Egypt is to resist it needs to have more resources at its disposal. If not the Romans, some other Empire would eventually have come calling to Egypt and they'd need to have an answer ready in order to survive as a Ptolemaic or native state.