Observations of the varying orientations of comet tails led to the suggestion of the existence of the solar wind-a continuous outflow of ionized material from the Sun. It is now well established that gas from comets is ionized by several processes and joins the solar wind, forming an ion (plasma) tail that points away from the Sun. The plasma environments of three comets have been measured in situ, but only in the upstream direction or less than 8,000 km downstream of the nucleus. Here we report a fortuitous crossing by a spacecraft of the plasma tail of comet Hyakutake (C/1996 B2), at a distance of more than 3.8 astronomical units (550 million kilometres) from its nucleus. This surpasses the tail length of 2 AU determined for the Great March Comet of 1843 (C/1843 D1). Our measurements reveal that, at this distance, the tail of comet Hyakutake was a structured entity at least 7 million kilometres in diameter.