Space probes often use planets to accelerate onto a trajectory towards their goal(s) without having to consume too much fuel. But the fastest acceleration would be made through the Sun's gravity if probes manage to get close enough. Was it ever possible for a spacecraft or would it be possible to build a spacecraft resistant to the Sun's heat and radiation from a realistic point of view? The Sun's gravity would accelerate probes extremely fast to distant goals so it would be very good for probes to the Kuiper belt, to the hypothetical planet beyond it or to the closest stars.
It doesn't really work that way. We can use the Sun to change direction, but we need rocket thrust to increase speed with the msneuver.
To begin with, the closest stars (apart from the Sun) are not close. If we were somehow to reach escape velocity from the Solar System (which this method won't do, see below), we would still be moving at only a small fraction of the speed of light unless we develop a propulsion system that generates energy internally or from what's in space itself. And stars like Proxima Centauri would take years of on-Earth time to reach even at the full speed of light.
Let's say there is a space probe heading for a "slingshot" encounter with Jupiter, in order to send it to the outer Solar System and beyond. We know that when the probe is flung outwards with enough acceleration to ultimately escape the Sun, Jupiter must be slowed down and drop (very slightly) closer to the Sun. We have really drawn energy from Jupiter's orbital motion.
So where is the Sun's orbital motion for a slingshot acceleration around that body? Technically, things in our Solar System do not orbit the Sun, they orbit the center of mass which is usually just outside the Sun. So the Sun has some orbital motion -- but very little compared with the motion of any planet, all of which are much farther away from the barycenter and make much longer arcs and faster orbital speeds. It is well known that if bodies with different masses (like the Sun and planets) interact and convert potential to kinetic energy, most of the kinetic energy as seen from the center of mass goes into the lighter bodies -- not, in this case, the heavy Sun. Hence the planets rather than the Sun have the energy of motion we need for a slingshot acceleration.
Moreover, we would also have to create a highly eccentric, basically almost parabolic orbit to get close to the Sun starting from our nearly circular Earth orbit. Even without a change in net orbital energy such a change is orbital shape requires a large delta-v. Planets are easier to reach, and both inner and outer planets (including Earth) have been used for this purpose.
With proper launch windows and planetary alignments, it's much easier to use planets to get the speed and direction we want to reach targets within the Solar System. Hence planets are the chosen means of energy exchange within the Solar System.
While a solar slingshot can't accelerate a spaceship out of the Solar System, it can be used to change direction while using rocket thrust at perihelion to boost your speed as the Sun's gravity changes your direction. Since the Sun's gravity is used only for the directional change and not for net increase in speed (the latter comes from the rocket thrust) it does not draw kinetic energy from the Sun, so it can be executed with good effect using the Sun's superior mass. Project Lyra (thanks David Tonhofer) has been launced as a feasibility study for a mission to the interstellat space asteroid ʻOumuamua. As yet, however, this is only preliminary, a long way from actually launching a rocket to put this idea into effect.
The "gravitational" (slingshot) maneuvers space probes are performing are actually not so much about gravity. The gravity is method to "tie" temporarily these two bodies, but you could (purely hypothetically of course) use something else, some superstrong tether or so ... "Slingshot maneuver" is in fact much better name in this regard.
What actually happens is momentum exchange. Space probe exchanges some amount of mometum with the planet. But momentum is no absolute quantity, you need a reference frame to talk about it.
The gravitational field is conservative. If you move in a gravity field of a single body stationary in your reference frame, you will always end up with same amount of momentum (in the same reference frame) in any fixed point regardless which trajectory you took to get there. So nothing to gain.
What are we doing with space probes is that despite the fact we haven't gained any momentum relative to the planet, we are "slingshoting" around, we have exchanged some amount of monetum this planet has relative to the Sun.
And that is the point. You can not get any extra energy relative to the Sun doing gravitational maneuver around the Sun. (This applies generally of course. You can not use gravitational maneuever around a planet X to brake and stop at the same planet for example.)
Note: there are some ways to gain an energy from gravity field if you are doing (significant) propulsion burns along the way, but I am not aware there was any such performed in a reality.
I think the question is based on a misconception about how gravity assists work.
If you just let yourself get pulled to a distant object then continue out the other side, the same gravity that attracted you to it will then begin pulling you back again. You'll just oscillate around it like a bouncing ball.
Gravity assists work because the target itself (e.g. Jupiter) is also moving, in its orbital motion. It "drags" you along briefly while you're strongly within its gravitational influence. You steal a bit of its orbital momentum (like the planet's given you a bit of a kick on your way past) and off you go. The planet still tries to pull you back towards it, but you have enough additional momentum to counter that.
The sun has no such thing (at least not within the frame of reference of the solar system itself), and its relatively large gravitational pull is not useful to you. You can fall towards it quickly, yes, but again you'd only be pulled back. And there is no orbital momentum for you to steal (well, very little).
So, no, this is not a thing.
In constrast to the other answers here, I would like to point out that the Oberth Effect does allow you to gain kinetic energy from a gravity well without needing to rob it of momentum ... if you fire your rocket motor at periapsis.
Atomic Rockets has an excellent discussion of what the Oberth effect can do.
So by burning 6 km/s of Δv, you get an actual Δv increase of 46.8 km/s. That's 40.8 km/s for free. Sweet!
By comparison, gravitational slingshots can get energy without any burn (or a trivial one):
Jupiter, with a mass 318 times that of Earth, can give a velocity kick of up to 30 kms/second to a passing spacecraft.
So, it does seem that properly leveraged, a near flyby past the sun could produce higher kicks than a slingshot past Jupiter.