"And the waters were a wall to them" (Exodus 14:22): He made them into a kind of wall. "On their right" - this is the mezuzah; "and on their left" - these are the tefillin.
Walls of Water on the Right and Left as Mezuzah and Tefillin
Yalkut Shimoni on Torah 234:4
וְהַמַּיִם לָהֶם חוֹמָה, כְּמִין חוֹמָה עֲשָׂאָן. מִימִינָם, זוּ מְזוּזָה, וּמִשְּׂמֹאלָם זוּ תְּפִלִּין.