David Docherty, 35, was given a 40-month sentence in April 2024 following a trial at the High Court in Glasgow.
The Lord Advocate asked the court to consider imposing a longer custodial term due to the serious nature of the offences.
The Appeal Court, chaired by Lord Justice Clerk Lady Dorrian, upheld the Crown appeal.
The original sentence has been quashed and replaced with a 10-year custodial term.
While sentence is rightfully the domain of the independent judiciary, the balance of justice is served by the Crown being allowed to appeal in limited circumstances.
The Appeal Court has set a high test to be satisfied for this to happen.
The sentence must be unduly lenient, meaning it falls outside the range of sentences which the judge could reasonably have considered appropriate having taken account of all relevant factors.
Deputy Crown Agent Kenny Donnelly said: “The Crown Office and Procurator Fiscal Service is committed to improving the criminal justice journey for victims, from the stage of reporting all the way through to sentencing.
“Prosecutors have a responsibility in legislation to consider appeals based upon undue leniency in sentencing.
"Such appeals are rare but important to ensure the public interest is properly served.
"They allow the court to review sentences that the Crown believes fall outside the range of punishment reasonably considered appropriate.
"COPFS believes that harm caused by offending, and the culpability of the convicted person, must be consistently reflected in sentencing decisions.”
Docherty was found guilty of culpably and recklessly firing a shotgun at the window of a house in Glasgow and possession of a shotgun without a licence.
He was also convicted of possessing a firearm or imitation firearm with the intention of causing a police officer to believe violence would be used against him.
He brandished what appeared to be a handgun at the constable, who had stopped the car in which Docherty was a passenger.
Docherty was also found guilty of attempting to pervert the course of justice by setting fire to a car.