There is no need to build a massive fire and create more of a hazard. A small campfire with hot coals can put out a lot of heat! With a proper size fire and good timing, your fire should be ready to die by the time you are ready to extinguish it.
If you can allow the firewood to burn down to ash, it is easier to extinguish. Start by spreading the coals as much as you can with a shovel, increasing airflow and removing any unburnt fuel to help it cool faster.
Once you have spread the coals it is time to douse the fire. Water is the best option, but you can also use sand or dirt if you do not have access to water. Pour the water onto the embers until the hissing stops, or throw a thin layer of dirt or sand onto the coals to inhibit its access to oxygen. Be careful not to apply too much dirt or sand, which can insulate the embers and potentially reignite itself later.
Stir the remaining ash to find remaining embers. If large logs remain, rotate and scrape the embers off of it before placing it burnt side down into the water.
Repeatedly stir, douse, and stir again until all the embers are extinguished and the fire is cool to the touch. You can also add a layer of dirt or sand on top as precaution.