It is usually added after something that you should do forever because the idiomatic expression, "while the sun shines" refers to the sun that is shining.
It will take a long long time before the sun stops to shine, so it makes the words before that idiom to be done 'forever'.