The invention belongs to the technical field of curtain rods, and discloses a curtain rod with a self-locking function, which comprises a main rod and two auxiliary rods, grooves are formed in the left side and the right side of the main rod, the two auxiliary rods are respectively inserted into the two grooves, and tooth grooves which are arranged at equal intervals are fixedly connected to the inner top walls and the inner bottom walls of the two grooves. A left tooth block and a right tooth block are arranged in each of the two grooves. According to the scheme, when the length of the curtain rod is adjusted, the pressing assembly is pressed, the pressing rod is driven to move into the groove, then the abutting assembly is driven to move, the tooth block is driven to be separated from the tooth groove, then the auxiliary rod is pushed and pulled according to installation requirements, the length of the curtain rod is adjusted, and after the length of the auxiliary rod is determined,force on the pressing assembly is canceled; the abutting assembly drives the tooth block to reset and be inserted into the tooth groove again, so that self-locking of the auxiliary rod is achieved, secondary change of the length of the curtain rod is prevented, the structure is ingenious, and the operation is easy.