According to the Telegraph, scientists have discovered that although the sun will expand in 7.7 billion years earth will survive. As the sun expands its mass will decrease which will lower its gravitational pull, allowing the earth to orbit further and further away from it:
According to the team from Sussex University, however, these calculations missed out a crucial effect: the loss of mass by the ageing Sun as it expands and its gravity weakens.
Taking this effect into account, the team found that the Earth would manage to dodge a fiery fate, its orbit expanding away from the swelling Sun.
According to Dr Robert Smith, one of the team that made the discovery, the dying Sun will make two attempts to destroy the Earth. In the first, about 7.7 billion years from now, it will expand to about 120 times its current size, engulfing the two innermost planets, Mercury and Venus.