The lifespan of a star is primarily determined by its mass. The more massive a star, the shorter its lifespan. The sun has a medium-sized mass compared to other stars, estimated to be about 2 x 10^30 kilograms. With this mass, the sun is expected to remain in the main sequence phase for approximately 10 billion years.
The sun is believed to be about 4.6 billion years old, based on various lines of evidence such as the radioactive dating of meteorites and models of stellar evolution. Considering its expected main sequence lifespan, the sun is about halfway through its main sequence phase and can be considered middle-aged.
As the sun ages, it will eventually transition into different phases, including the red giant phase and the white dwarf phase. However, these later stages of stellar evolution occur over billions of years, and the sun is still expected to remain in the main sequence phase for several more billion years.