The government says the new law will help crack down on "puppy farms" and make it harder for unscrupulous dealers who have little regard for animal welfare.
The decision follows a public consultation that found overwhelming support for banning third-party sales.
Under the new measure, people wishing to adopt a puppy or kitten would have to deal directly with a breeder or a re-homing center, rather than pet shops or other commercial dealers.
Animal welfare groups praised the government measure as an important step forward. Marc Abraham, a veterinarian who appears on television and is the founder of Pup Aid, called it "a real victory for grassroots campaigners as well as the U.K.'s dogs and cats."
He said the law would make breeders more accountable and make it more difficult to sell illegally smuggled puppies and kittens.
The change was also endorsed by one of Britain's best-known animal shelters, the Battersea Cat and Dogs Home.
It comes as the RSPCA is asking the British public for information about the identity of a passenger and driver caught on closed circuit TV abandoning a dog despite its pleas to be allowed back into the car.
The abandonment took place earlier this month in Trentham, 145 miles (235 kilometers) northwest of London, but the video was circulating Monday online.
"To see the poor dog in such obvious distress, jumping up at the car as it drives away, is just heartbreaking," said RSPCA inspector Natalie Perehovsky. "I can't understand how someone could do this."