Cephalopods, and particularly squid, play a central role in marine ecosystems and are a prime model animal in neuroscience. Yet, the capability to investigate these animals in vivo has been hampered by the inability to sedate them beyond several minutes. Here, we describe methods to anesthetize Doryteuthis pealeii, the longfin squid, noninvasively for up to 5 h using a 0.15 mol magnesium chloride (MgCl$_2$) seawater solution. Sedation was mild, rapid (<4 min), and the duration could be easily controlled by repeating anesthetic inductions. The sedation had no apparent effect on physiological evoked potentials recorded from nerve bundles within the statocyst system, suggesting the suitability of this solution as a sedating agent. This simple, long-duration anesthetic technique opens the possibility for longer in vivo investigations on this and related cephalopods, thus expanding potential neuroethological and ecophysiology research for a key marine invertebrate group.