The capitulation of Rhodesia from the Pink Map to British pink is what caused it, so you would want to look over that. Do you mean to have it keep going until present day undisturbed, or would you allow it to be invaded like Norway where they aboloshied the monarchy or like in Spain where they set up a vacant throne? Would you accept a monarchy? Does the royal family need to remain the same? Perhaps you could try marriages with the Brazilians. *Twangs banjo*
Well, the capitulation from the Pink Map was the spark that started the crisis of the monarchy, but I think it's too unidimensional and oversimplistic to explain the fall of the portuguese monarchy only with that. In fact I think we can wonder wether this capitulation wasn't a symptom rather than a cause. Leaving aside the butterflies that pushing for the Pink Map would have in portuguese history (probably for the worse) it alone wouldn't have saved the monarchy, which was rotten long before and faced many other problems.
You have to consider the effects of the deep economical crisis Portugal suffered in the late 19th century, with a bankrupcy in 1891 and how that changed the mind of the portuguese elite and their considerations about the economical governance of the country. In short, lacking credit and lossing markets for their agricultural exportations led to the reconsideration of certain politics, implementing several protectionist measures and allowing for a relative political and economical rise of the industrial and commercial bourgeoisie and a growth of the internal investments. As consequence, for example, Lisbon population grew a 44% between 1890 and 1911, and Porto's a 40% in the same period (data after Fernando Rosas)
So, we have the crisis of legitimacy with the monarchy lossing traditional supporters, but also the economical crisis, a rising industrial class and a rising urban popualtion under a political system (the liberal monarchy) that restricted tremendously the political participation and was anchored in the electoral fraud, the clientelism and a power pact between the two main parties since the mid 19th century. Thus, the old structure was surpassed by the events in the 1890's and was even more surpassed by the internal evolution of Portugal in the 1910's and was apparently unable to react properly to them.
Perhaps some of the portuguese members can correct me if I have said something wrong, but it seems to me that the Pink Map episode was "only" an straw on a serioulsy wounded camel.
So, adressing the OP question, I'm not an expert in portuguese history so I can only give you a generic response, but I think you need deep structural reforms at least in the mid 19th century to avoid the 1890's crisis. Easy to say, but hard to do, I know. Otherwise, perhaps there is a possibility to avoid the final fate of the monarchy in those delicate 20 years between 1890 and 1910 if the crown tries to gain to their cause some of the traditionally marginalized social and political groups, opening the political participation (instead of restricting it even more as they did in OTL), but I guess that would also mean lossing more of the traditional supporters and trouble from them.
Cheers.
Edit: Sorry Janprimus for repeating your point about the Pink Map. I write really slowly.