We study the impact of gas accretion on the orbital evolution of black-hole binaries initially at large separation in the band of the planned Laser Interferometer Space Antenna (LISA). We focus on two sources: (i)~stellar-origin black-hole binaries~(SOBHBs) that can migrate from the LISA band to the band of ground-based gravitational-wave observatories within weeks/months; and (ii) intermediate-mass black-hole binaries~(IMBHBs) in the LISA band only. Because of the large number of observable gravitational-wave cycles, the phase evolution of these systems needs to be modeled to great accuracy to avoid biasing the estimation of the source parameters. Accretion affects the gravitational-wave phase at negative ($-4$) post-Newtonian order, and is therefore dominant for binaries at large separations. If accretion takes place at the Eddington or at super-Eddington rate, it will leave a detectable imprint on the dynamics of SOBHBs. In optimistic astrophysical scenarios, a multiwavelength strategy with LISA and a ground-based interferometer can detect about $10$ (a few) SOBHB events for which the accretion rate can be measured at $50%$ ($10%$) level. In all cases the sky position can be identified within much less than $0.4,{rm deg}^2$ uncertainty. Likewise, accretion at $gtrsim 10%$ ($gtrsim 100%$) of the Eddington rate can be measured in IMBHBs up to redshift $zapprox 0.1$ ($zapprox 0.5$), and the position of these sources can be identified within less than $0.01,{rm deg}^2$ uncertainty. Altogether, a detection of SOBHBs or IMBHBs would allow for targeted searches of electromagnetic counterparts to black-hole mergers in gas-rich environments with future X-ray detectors (such as Athena) and radio observatories (such as SKA).