We construct gravitational modifications that go beyond Horndeski, namely theories with extended nonminimal derivative couplings, in which the coefficient functions depend not only on the scalar field but also on its kinetic energy. Such theories prove to be ghost-free in a cosmological background. We investigate the early-time cosmology and show that a de Sitter inflationary phase can be realized as a pure result of the novel gravitational couplings. Additionally, we study the latetime evolution, where we obtain an effective dark energy sector which arises from the scalar field and its extended couplings to gravity. We extract various cosmological observables and analyse their behavior at small redshifts for three choices of potentials, namely, for the exponential, the powerlaw, and the Higgs potential. We show that the Universe passes from deceleration to acceleration in the recent cosmological past, while the effective dark-energy equation-of-state parameter tends to the cosmological-constant value at present. Finally, the effective dark energy can be phantom-like, although the scalar field is canonical, which is an advantage of the model.PACS numbers: 04.50. Kd, 95.36.+x