The sun is losing mass in several ways. The main way the sun is losing mass is through nuclear fusion in its core. Fusion is changing hydrogen to helium, the hydrogen used weighs slightly more than the helium produced. The difference is changed to energy with a little help from Einstein's E = mc² and this energy is what we see as light.
You've also got solar wind, which at about [310 miles] 500 kilometers a second, is pretty fast, and it's steady it carries mass away all the time. The solar wind is just driven by the energy and the temperature of the sun and the wind is then flowing out from the sun. Most people already talk about solar wind but don't think about these big events called coronal mass ejections. So You suddenly get a big flare and the sun loses a lot of mass in one go.
So the sun loses a little bit of mass in the solar wind, and about three times as much in nuclear fusion. But even if you add all that together, that is still nothing compared to the mass of the sun. The sun is something like a million times more massive than the Earth and loses an amount of mass equal to the mass of the Earth about every 100 million years. So compared to the sun's lifetime of 10 billion years, compared to the mass of the sun that is nothing. So by the time the sun becomes a red giant and has finished the normal nuclear burning, it will still have pretty much the same mass as it has now.