A schoolteacher, Junpei Niki (Eiji Okada), is on an expedition to collect insects that inhabit sand dunes. When he misses the last bus, villagers suggest he stay the night. They guide him down a rope ladder to a house in a sand quarry where a young widow (Kyōko Kishida) lives alone. She is employed by the villagers to dig sand for sale and to save the house from burial in the advancing sand.
When Junpei tries to leave the next morning, he finds the ladder removed. The villagers inform him that he must help the widow in her endless task of digging sand. Junpei initially tries to escape. Upon failing he takes the widow captive but is forced to release her in order to receive water from the villagers.
Junpei becomes the widow's lover. He still, however, desperately wants to leave. One morning, he escapes from the sand dune and starts running while being chased by the villagers. Junpei is not familiar with the geography of the area and eventually gets trapped in some quicksand. The villagers free him from the quicksand and then return him to the widow.
Eventually, Junpei resigns himself to his fate. Through his persistent effort to trap a crow as a messenger, he discovers a way to draw water from the damp sand at night. He thus becomes absorbed in the task of perfecting his technology and adapts to his "trapped" life. The focus of the film shifts to the way in which the couple cope with the oppressiveness of their condition and the power of their physical attraction in spite of — or possibly because of — their situation.
At the end of the film Junpei gets his chance to escape, but he chooses to prolong his stay in the dune. A report after seven years declaring him missing is then shown hanging from a wall, written by the police and signed by his mother Shino.