A centripetal force is a force directed towards the centre. It's just a characterisation of an existing force. "Centripetal" means "towards the centre" in Greek.
So, in the solar system, the sun exerts a gravitational force towards itself, and it is a centripetal force.
Regarding your other question: how does gravity work? According to general relativity, energetic or massive objects distort space, so that other objects passing through the distorted space do not go straight, but bend their trajectory. From their point of view, they experience a force (gravity), and consequentially an acceleration which changes their trajectory.
So according to general relativity the medium through which gravity acts is actually the distortion of space.
This is what your astronomy teacher called "a 3D blanket".
Instead, according to Quantum Field Theory, forces are mediated by appropriate particles actually moving through space. Gravity would be carried by particles known as gravitons.
In both these theories, there is no action-at-a-distance, so body don't exert forces on one another instantaneously, but there's always something "in the middle" that carries or represents the force.