The sun heats up the land's surface, especially during the middle of the day. The land transmits this heat to the air above it. Meanwhile, the sea and the air above do not warm up so quickly. The difference in temperature between the air over the land and the air over the sea means there is a pressure difference too. Air rushes from the sea to the land to equalise this pressure difference. This is what creates a sea breeze.
At night the land cools off very quickly and its temperature drops below the temperature of the sea. The temperature of the air above the land drops too, below the temperature of the air above the sea. The difference in temperatures means a difference in pressure and air rushes out to equalise the pressure. This creates a land breeze. Land breezes are not as strong sea breezes.