You can spend a bundle of money on a rifle to get it to shoot better with new barrels, new trigger, bedding the action and so on. Any of these might work. Or not.
A cheaper way to get more from a gun is to keep a shooting log. John Plaster, a retired Army major and sniper, gives the details here and we've included a downloadable .pdf of his shooting log here.
I keep track of every shot I take with the firearms I own and those I review for the magazine and over the years those records have revealed some fascinating data--including when to dump a rifle that just won't shoot.