X-ray diffraction (XRD) and magnetic measurements were employed to investigate the effect of Ga substitution for Co on the structure and magnetic properties of Y2Co17-xGax and Tb2Co17-xGax compounds (x = 0, 1, 2, 3, 4, 5, 6, 7 and 8). XRD patterns show that all samples are single phase with the hexagonal Th2Ni17-type structure or the rhombohedral Th2Zn17-type structure except the samples with x = 7 and 8 which contain a small amount of Co. The Ga substitution for Ca in Y2Co17-xGax and Tb2Co17-xGa, compounds leads to a monotonic increase in unit cell volume and an approximately linear decrease in saturation magnetization. The Curie temperature Te is found to decrease rapidly with increasing Ga concentration. The compensation points are observed for the Th2Co17-xGax samples with x = 4, 5 and 6. The intersublattice-molecular-field coefficients, n(RT), have been deduced on the basis of magnetization curves at the compensation temperature. The exchange-coupling constants J(RT) and J(TT) have been calculated by analysing both the field dependence and the temperature dependence of the magnetization. it has been found that the substitution of Ga for Co in these compounds reduces the Go-Co exchange interaction, while it has little influence on the R-Co exchange interaction. It is noteworthy that the Ga substitution has not changed the room-temperature easy magnetization direction for both Y2Co17-xGax and Tb2Co17-xGax compounds.