Planet Earth has 3 layers: the outer crust, the middle mantle and the innermost core. The core is further divided into the inner core and the outer core. The inner core of Earth is made of (mostly) solid iron and has a temperature of more than 5000 degrees Celsius. Interestingly, the melting point of iron is about 1538 degrees Celsius. Yet the inner core is solid. The reason for this is the high pressure on the inner core of Earth. At high pressure, molecules are forced together and hence cannot exist as either liquid or gas. The decrease in intermolecular spacing causes the inner core material to exist as a solid.
In general, as temperature increases (while keeping the volume constant), the molecules move faster and have more collisions with each other. This causes higher pressure and forces molecules together. Higher pressure causes the change of state of materials.
Hope this helps.