Do the laws of physics permit any chance for a Type III civilization on the Kardashev scale to halt or even reverse the expansion of the universe, or bring the galaxies back closer together, assuming they had a few billion years to accomplish it? Would it have to be a Type IV on the extended scale?
It does not have to be a biological civilization where individuals are mortal. It could be an self-aware AI civilization or any other kind that doesn't have to deal with internal conflicts or fluctuations in public opinion or priorities or anything else that would be distracting.
We assume that heat death of the universe is inevitable because of entropy, but we also know that energy can't be created or destroyed - so, it here any way to prevent the heat death of the universe by stopping the galaxies from drifting apart, even a few of them, if not all? All stars eventually burn out, but perhaps the loss (dissipation) of their energy could be prevented by enclosing them in hermetically sealed Dyson spheres?