Method for producing a pipe from biaxially oriented thermoplastic material, which pipe has a pipe body and, at one or both of its ends, an integral socket, a pre-fabricated pipe from biaxially oriented thermoplastic material being subjected to a socket-forming operation using a socket-forming device, which socket-forming device comprises a socket-forming mandrel which is slid into the interior of an end part of the pipe which has previously been produced, which end part, at a suitably elevated temperature, is formed into a socket, after which the end part is cooled and the socket-forming mandrel is removed from the end part, characterized in that the end part, prior to the introduction of the socket-forming mandrel, is first heated to a first temperature, which lies, for example, just above the glass transition temperature, and then only an outermost annular region of the end part, which adjoins the free end of the end part, is heated to a second temperature, which is higher than the first temperature, after which the socket-forming mandrel is introduced into the end part, the annular region which is at the second temperature—if the socket-forming mandrel is provided with expandable groove-forming elements—preferably being situated at the location of the groove-forming elements.