Stars can gain mass if they are members of an accreting binary system.
As one star evolves into a red giant, some of its mass can be captured by a companion star. If that star is a normal star, the added mass will probably cause the star to burn hotter as its gravitational mass is increased. If the companion star is a white dwarf or a neutron star, the matter falls to the surface and builds up until some threshold is reached in temperature or density, and the surface erupts as a nova explosion. If the companion is a black hole, the mass is absorbed but some of it is converted into energy to produce a luminous x-ray source. These are the more common ways for an evolved star to gain new mass.