I'm sure some sort of Imperial Federation could work long-term. The idea has been proposed multiple times, occasionally with detailed plans and more often in a more general sense.
What could work out very well would be a very loose system, wherein British North America, the British Caribbean, India, South Africa, Australia and New Zealand (and ideally Ireland) are largely self-governing, but bound by the same fundamental legal system as the UK. They'd all have the same monarch, would all be obligated to pay certain taxes to the crown, would be in an economic and military union with the UK... but would otherwise be functionally independent. Benefits, ultimately, would include a great big internal market (from which all participants profit) and the enduring protection of the Empire's military power.
This would be an Imperial Confederation instead of Federation; essentially a Commonwealth-Plus. But it would avoid the problems that a more unified federation would inevitably face. Mainly the issue of representation: if the aforementioned polities are almost fully autonomous, they would not need representation in Parliament, and the ever-lurking threat of a Federation become the 'Indian Empire' is avoided.
Needless to say, Britain had many other colonial possessions, but I'm assuming that places like, say, Nigeria or Sierra Leone would remain powerless colonies. Eventually, during the era of decolonization, such colonies would either become self-governing parts of the Empire or split off and become independent states.
(Disclaimer: the view presented here might be overly optimistic, as it is an illustration of my firmly held belief system that hinges on the idea that decentralization is good for all and therefore Confederations Solve Everything™.)