I was wondering if the sun's radiation affects the gravity when it passes through space? Like can radiation strengthen or weaken the force of gravity?

Radiation has energy, and energy exerts gravity. You could say that it "strengthens the force of gravity" (it definitely doesn't weaken it), but it would be more appropriate to say that it contributes to the total gravitational field.

The effect it immensely small, however, and is in almost all circumstances completely insignificant compared to the gravity of other forms of mass/energy. But most of the radiation in the Universe is the so-called cosmic microwave background, and because this radiation is gradually redshifted with time, it used to be more energetic, and hence exert more gravity. It is fairly easy to calculate that until the Universe was roughly 50,000 years old, radiation actually dominated the gravitational field.

Prologue:

As Zephyr points out below, the term "exerting gravity" is not really the correct way of describing gravity. In general relativity, objects are assumed follow straight lines in space, unless a force (e.g. electromagnetic) acts upon it. What we interpret as "gravity" is the deviation from what we think is "straight ahead", caused by a geometrical change in the space (and time) — and thus in the mathematical rules we use to calculate e.g. how parallel lines behave, how many degrees there are in a triangle, etc — around a massive object. The deformation of space is given by the Einstein field equations, in which the so-called stress–energy tensor appears. This is a mathematical object consisting of 16 numbers, of which one number (the "$T^{00}$'th component") holds the energy density of everything, i.e. radiation, dark matter, dark energy, stars, planets, bicycles, and — in particular — your mom.

• Just to add to this, the phrase "energy exerts gravity" is a very Newtonian description of gravity. A phrase more in line with GR might be "energy bends space-time". It all depends on how you want to think about it. – zephyr Jul 20 '17 at 14:57
• @zephyr: I initially included a description of the stress-energy tensor, but ended up deleting it, to keep this answer at a level I think is appropriate. But, by request, here you are :) – pela Jul 21 '17 at 20:54