by David Murphy
A tide is a short-term change in the height of ocean water, due largely to the gravitational pull of the sun and moon.
The earth, sun and moon---like any other large masses in space---exert a certain amount of gravitational attraction toward each other. The moon has the strongest influence on the earth, because it's so much closer than the sun. But the sun also has an influence, because it's so big. Water reacts easily to this pulling from the sun and moon, because it's not a solid and is free to lift from the surface slightly as it comes under the influence of these other bodies.
By the way, you might be interested to know that the earth is not a perfect sphere. It actually bulges at the equator, thanks to the way the planet spins on its axis. The forces associated with the earth's rotation also affect tides a bit, but the gravitational pull of the sun and moon are the most important to our local tides.
And one more thing... You may have heard the expression, the tide is rolling in. To me, this implies that the water is moving toward the beach from somewhere else, which could be a little misleading to some people. Keep in mind that a tide has more to do with the ocean rising higher as it's pulled toward the sky by the sun or moon's gravity field. The fact that it then moves sideways into higher ground is merely another affect of gravity---this time, the earth's gravity which pulls the water ashore so that it can fill in any areas below its new, higher surface level.