Short version: If we work hard at recovering fossil fuels, huge amounts remain. We are probably at least decades and perhaps longer from real scarcity of fossil fuels, although with notable uncertainty. But, we may be close to the point at which fossil fuels are scarce enough to start causing problems.
Friendlier but longer version: Experts in the field generally separate fossil-fuel “reserves” from “resources” (and, they have additional technical terms that subdivide these big types). You might say that “reserves” are what you are (almost) sure you can use in the modern economy with modern technology, whereas “resources” are what you think you can have in the future.
For example, the US Energy Information Agency, in defining “proved reserves” for oil (also known as “proven reserves”; similar definitions apply for gas and coal), says that this includes “the estimated quantities of all liquids defined as crude oil, which geological and engineering data demonstrate with reasonable certainty to be recoverable in future years from known reservoirs under existing economic and operating conditions.
Their data indicate that, as of 2011 (the last year for which full data were available at the time this was being written; a partial update in 2016 didn’t change these numbers much), the world had 46 years of proved reserves at current rates of use. These numbers were higher for gas (150 years) and coal (120 years). With oil slightly more important than the others in the world economy, these would give most of a century of fossil fuels before we run out. However, use has been rising rapidly. If everyone in the world used fossil fuels at the same rate as in the US, total use would be more than 4 times faster, reducing the life of the proved reserves to perhaps 20-30 years.
The resource is likely much bigger. If you spend a little while looking at the figure "Where is the Carbon?” just below, you’ll see first that the authors from the US NOAA are discussing how much fossil fuel we have, and how much we’re burning, in units of gigatons of carbon. (1 gigaton of carbon = 1 Gt C. A gigaton is a billion tons. Fossil fuels contain some hydrogen and a little bit of other things, but focusing on the carbon is a useful way to calculate.) The authors estimate that we have already burned fossil fuels containing about 244 Gt C, from an original 3700 Gt C, leaving 3456 Gt C to be burned. The figure is a few years old, and the use rate of 6.4 Gt C per year that they show has increased to perhaps 9 Gt C per year. That would leave almost 400 years of fossil fuels at current use rate, or less than a century if everyone reached the US rate (and even less if population continues growing). Some estimates of the resource are even bigger, in the range of 4000 to 6000 Gt C, and even more if we figure out how to use clathrate hydrates, which might have about as much carbon as the other fossil fuels although probably notably less.
Please watch the following video: