You are correct -- the pull of the moon causes
tides. All objects have at least a tiny bit of
gravitational pull, but bigger objects (with a
larger mass) have bigger pull. The other factor is
distance -- the further away something is, the
smaller force it exerts.
To compare, the sun also causes a slight tide
on earth. The mass of the sun is so big that it
keeps earth in orbit even though it's so far away.
On top of that, we can feel it's pull on the earth
through the tides. When the moon and sun align
on one side of the planet, both of them are
pulling in the same direction and we get stronger
tides (called spring tides). When the moon
and the sun are on opposite sides of the earth, we
get smaller tides (called neap tides).
The center of the earth is much closer to our
oceans than either of the sun or the moon, which
is why we feel the earth's gravity the strongest,
but the tides are a good way of seeing how gravity
from other bodies affects us.
picture of tides
I took this picture from