Gravity is one of the four fundamental interactions of nature. Gravity is the cause of the forces of attraction between bodies with mass.
According to the "law of universal gravitation of Newton", the mass of a body located at a point in space, is associated with a "gravitational field"; this field exerts a force of attraction on the other body at a distance from its center. The "gravity" or gravitational field strength of a body with mass M at a distance d is described by the following equation:
g = GM/d2
Where M is the mass of the body, d is the distance from the center of the body to the point and G is the "universal constant of gravitation".
The Sun is a body with a very large mass,, therefore, in the space surrounding it establishes a gravitational field which exerts a force on the earth and the other planets of the solar system; this force keeps planets in their orbits.
Albert Einstein described the "gravity" as a deformation of space-time caused by the mass of the celestial bodies. In either case, the mass of the bodies, is the cause of gravity.
In conclusion, the sun has gravity and the cause is the solar mass.