Modelling the anisotropies in the cosmic infrared background (CIB) on all the scales is a challenging task because the nature of the galaxy evolution is complex and too many parameters are therefore often required to fit the observational data. We present a new halo model for the anisotropies of the CIB using only four parameters. Our model connects the mass accretion on the dark matter haloes to the star formation rate. Despite its relative simplicity, it is able to fit both the Planck and Herschel CIB power spectra and is consistent with the external constraints for the obscured star formation history derived from infrared deep surveys used as priors for the fit. Using this model, we find that the halo mass with the maximum efficiency for converting the accreted baryons into stars is log 10 M max = 12.94 +0.02 −0.02 M , consistent with other studies. Accounting for the mass loss through stellar evolution, we find for an intermediate-age galaxy that the star formation efficiency defined as M (z)/M b (z) is equal to 0.19 and 0.21 at redshift 0.1 and 2, respectively, which agrees well with the values obtained by previous studies. A CIB model is used for the first time to simultaneously fit Planck and Herschel CIB power spectra. The high angular resolution of Herschel allows us to reach very small scales, making it possible to constrain the shot noise and the one-halo term separately, which is difficult to do using the Planck data alone. However, we find that large angular scale Planck and Herschel data are not fully compatible with the small-scale Herschel data (for > 3000). The CIB is expected to be correlated with the thermal Sunyaev-Zel'dovich (tSZ) signal of galaxy clusters. Using this halo model for the CIB and a halo model for the tSZ with a single parameter, we also provide a consistent framework for calculating the CIB × tSZ cross correlation, which requires no additional parameter. To a certain extent, the CIB at high frequencies traces galaxies at low redshifts that reside in the clusters contributing to the tSZ, giving rise to the one-halo term of this correlation, while the two-halo term comes from the overlap in the redshift distribution of the tSZ clusters and CIB galaxies. The CIB × tSZ correlation is thus found to be higher when inferred with a combination of two widely spaced frequency channels (e.g. 143 × 857 GHz). We also find that even at ∼ 2000, the two-halo term of this correlation is still comparable to the one-halo term and has to be accounted for in the total cross-correlation. The CIB, tSZ, and CIB × tSZ act as foregrounds when the kinematic SZ (kSZ) power spectrum is measured from the cosmic microwave background power spectrum and need to be removed. Because of its simplistic nature and the low number of parameters, the halo model formalism presented here for these foregrounds is quite useful for such an analysis to measure the kSZ power spectrum accurately.