After the completion of an initial clinical trial, sponsors may choose to or be required by regulatory agencies to conduct an extension study in which patients will continue to receive the study treatment. Combining data from the two studies will provide a treatment duration longer than individual studies that can be used to evaluate long-term treatment effect and safety. In practice, there are often treatment gaps between the initial clinical study and the extension study. The treatment gaps can have a negative impact on study outcomes, and the duration of treatment gaps often varies by individuals. To account for the treatment gap and the duration of the gap, we developed a piecewise mixed model that allows a growth rate during the treatment gap to be different from the growth rate when individuals are treated; it also allows individuals to have their own treatment gap start and end days. This model was applied to a pooled database of clinical trials with extension studies. The model provides flexibility to fit the data with various treatment gap durations and to adjust their impact on treatment effect.