Eventually, the sun will start to run low on hydrogen in its core. As that happens, gravity will start to get the upper hand again and gradually squeeze the sun's core harder and harder until the core temperature reaches 100 million degrees. At that enormous temperature, three helium atoms can crash into each other fast enough to overcome electromagnetic repulsion and get within a trillionth of a centimeter of each other where the strong force will take over and fuse them into carbon.
\