Sound is nothing more than a local disturbance whose propagation is facilitated by the collisions between particles; this disturbance propagates in a logitudnal wave; imagine one molecule hitting the next molecule, and then that molecule hitting the next, and so forth.
The distances between molecules in solids are very small, i.e., solids are more dense - as compared to liquids and gases. Because they are so close, than can collide very quickly, i.e. it takes less time for a molecule of the solid to 'bump' into its neighborough. Solids are packed together tighter than liquids and gases, hence sound travels fastest in solids. The distances in liquids are shorter than in gases, but longer than in solids. Liquids are more dense than gases, but less dense than solids, so sound travels 2nd fast in liquids. Gases are the slowest because they are the least dense: the molecules in gases are very far apart, compared with solids and liquids.