As long as you have useable energy in your ship, you can use it to accelerate indefinitely your propellant in the opposite direction you want to accelerate; this is how rockets work. The propellant is basically something that carries away linear momentum in one direction so that the ship can gain momentum in the opposite direction.
Indeed, as you realise, there is no friction in space.. well, there is a tiny bit, because space is not 100% empty, it has trace amounts of dust, hydrogen and radiation. But this dust will not cause any significant drag unless you move really fast relative to the dust (say, at a significant fraction of the speed of light)
The problem is that since, space is so empty, there is really no practical way to have energy available for propulsion unless you carry it with you as fuel. There have been some proposals that try to work around this severe limitation, as the Bussard ramjet, and the laser light-sail proposed by Robert Forward: the first tries to use the hydrogen available in space as fuel, while the other captures a very powerful laser in a super-lightweight sail and accelerates by the momentum imparted by the light
If the ship carries the fuel, it means that the energy spent for acceleration needs to be used not only accelerating the payload, but also to accelerate the fuel mass that you are carrying with you! This leads to something called the rocket equation, which relates the density energy of your fuel, the ratio between the mass of the fuel and the payload, and the final velocity that you can achieve
The resulting analysis of the rocket equation shows that for fuels like hydrogen chemical combustion with oxygen (which is the most efficient chemical fuel we have) we are really bounded around the 300 sec (this is an unit called ISP, which measures how efficient is your fuel to produce kinetic energy)
If you consider other fuels, like nuclear fission reactions, or nuclear fusion, you can get more interesting efficiencies. For instance, the Daedalus project, developed on the seventies, proposed a interstellar starship to reach 5 light years in a trip of 80 years using fusion pellets as the fuel.
Beyond that, Eugene Sanger studied using antimatter-matter reactions to propel a spaceship. Such fuel would be theoretically the most efficient fuel physically possible in our universe, since the resulting reaction converts the full mass-energy of the particles in radiation (according to the formula $E=m c^2$), this has not been deemed practical in the foreeseeable future, because creating anti-matter fuel is inefficient and expensive, but more importantly, because it is extremely non-trivial to store the fuel safely inside a physical container, in such a way that can be used to propel a rocket ship.