We report on a measurement of the flavor-specific Bs0 lifetime and of the Ds- lifetime using proton-proton collisions at center-of-mass energies of 7 and 8 TeV, collected by the LHCb experiment and corresponding to 3.0 fb-1 of integrated luminosity. Approximately 407 000 Bs0→Ds(∗)-μ+νμ decays are partially reconstructed in the K+K-π-μ+ final state. The Bs0 and Ds- natural widths are determined using, as a reference, kinematically similar B0→D(∗)-μ+νμ decays reconstructed in the same final state. The resulting differences between widths of Bs0 and B0 mesons and of Ds- and D- mesons are ΔΓ(B)=-0.0115±0.0053(stat)±0.0041(syst) ps-1 and ΔΓ(D)=1.0131±0.0117(stat)±0.0065(syst) ps-1, respectively. Combined with the known B0 and D- lifetimes, these yield the flavor-specific Bs0 lifetime, τBs0fs=1.547±0.013(stat)±0.010(syst)±0.004(τB) ps and the Ds- lifetime, τDs-=0.5064±0.0030(stat)±0.0017(syst)±0.0017(τD) ps. The last uncertainties originate from the limited knowledge of the B0 and D- lifetimes. The results improve upon current determinations.