Probably its mass will have changed a bit, but would it be enough to lose for example Neptune?
Excluding chaotic events, the answer is no.
Suppose that in one short duration, cataclysmic event, the Sun ejects 49% of its mass in the form of a thin spherical shell that retreats from the Sun at greater than escape velocity. Even this extreme event would not be enough to make the Sun lose its planets. Ignoring drag interactions between this expanding shell and the planets, a planet's angular momentum relative to the center of mass of the Sun+expanding shell will be more or less conserved across the brief encounter with the shell. Assuming a circular orbit just prior to the encounter, the planet's velocity is given by $v^2 = \frac{G(M_r + M_s)}{r}$, where $M_r$ is the mass of the remnant Sun and $M_s$ is the mass of the expanding shell. This velocity will be conserved across the encounter.
By the vis viva equation ($v^2 = GM\left(\frac 2 r - \frac 1 a\right)$), the semi-major axis length after the encounter is given by $\frac 1 a = \frac 1 r\left(\frac{M_r - M_s}{M_r}\right)$. We must have $M_r < M_s$ to have this be non-positive, the key characteristic of an unbound trajectory. But per the hypothesis, the Sun has only lost 49% of its mass, so $M_r > M_s$. Since the real Sun will eventually end up as a white dwarf that is about 54% of the Sun's current mass, the planets will remain bound even if the Sun ejects 46% of its mass in one brief cataclysmic event.
That one brief cataclysmic event is not how things will come to pass. Outgassing will increase dramatically once the Sun becomes a red giant. This outgassing will be more or less continuous until the Sun starts burning helium at the tip of the red giant branch. This more or less continuos outgassing up until the tip will cause the planets to slowly drift outward but retain their more or less circular orbits. The situation will get more complex after the tip, but the Sun will never eject more than 50% of its mass in one big cataclysmic event.