When the question of surviving colonial empires comes up, the suggested solutions almost always include stuff like ‚assimilation‘, or ‚Imperial Federations‘, or representation in some kind of imperial parliament. But if we take the British example, such solutions wouldn‘t really work in the long term, considering the massive population differences we are talking about.
Bringing ‚western values‘ to India, Africa or somewhere else has historically always led to anticolonial sentiments, not because Indians and Africans hated western values so much, but because they claimed the rights derived from those very values for themselves. The ‚white man‘s burden‘ is what has paradoxically led to the emancipation of colonial populations from their imperial overlords, because they adopted western ideas like liberalism, nationalism, self-determination etc.
I think the only way for colonial powers to retain their colonies (other than permanent, brutal, Belgian-Congo-style repression) is to do the opposite of what they did IOTL, and adopt a more hands-off approach, which means no uplifting, no building of schools, hospitals or universities, no missionary work, no imposition of enlightenment values (like the British ban on widow burning in India, for example), no creation of local, westernized elites, no colonial subjects invited to study in western universities, no infrastructure for the local population etc.
Basically, make sure those colonies remain underdeveloped and their populations uneducated, and (other than trading outposts, naval and military bases) build only those facilities and infrastructure that is needed for resource extraction, nothing else. I think it would be much easier for the British to retain India for example if it still looked more or less like it did two hundred years ago, or as some remote corners of the subcontinent still do to this day (unless India ‚pulls a Meiji‘ on its own).
In summary, i think the colonial powers would paradoxically have an easier time retaining their empires in the long term if they behaved less ‚imperial‘, though this would probably also mean most of those colonies will remain much poorer compared to OTL.