My neighbour a few doors down has done this.
Our gardens back onto a public footpath bordered by wide grass verges. My neighbour's garden extends on to part of the verge, with a fence around it to make it part of her garden.
She says it was like that when she bought the house, but reckons it's as simple as building the fence and waiting a few years, after which time the land becomes mine. Is that true or absolute nonsense? I've emailed the council planning department to ask, but haven't yet had a reply.