To stave off the heat death there are several strategies- you start by surrounding every star you can with energy traps, saving the starlight in a big high tech battery (perhaps as antimatter) until all the stars run out;
you can even slow down the lifetime of the star by stripping mass off the star (smaller stars burn more slowly)
Once all the stars have died and you have used all the stored energy- this will be perhaps a couple of hundred billion years from now-
you can start living off the Hawking radiation emitted by black holes-
and to suppliment this you can gather all the mass of the dead stars and chuck them into artificial black holes- this converts dead matter into energy quite nicely...
eventually, a few trillion years or more later you will want to shut down into an energy saving mode, running sentient programs on processors that reverse the computations as far as possible, and use little energy.
Proton decay will detroy solid matter by 10^37 years, but if there is any way to exist without protons, there will still be a few galactic black holes around weakly radiating until 10^100 years- that is a googol years from now...
long enough?
-------------------------------
SF worldbuilding at
http://www.orionsarm.com/main.html