Every month for years, Heidi Cornell-McKenna paid $8,000 to her elderly neighbor in the Hollywood Hills of Los Angeles. In exchange, she earned the right to buy the woman’s house when she died. Her neighbor died at age 100, and Ms. Cornell-McKenna closed on the house last February.

Adam Solomon and his husband “did a dance for a solid two years” with their next-door neighbors in Manhattan, with each couple hoping to buy the other out. Mr. Solomon said the Long Island City skyline view from their combined apartments was worth the roughly $15,000 over market value he paid for the place next door.

With larger spaces scarce in hot markets, some homeowners are finding creative ways to buy their neighbors’ properties, using persistence, charm and detective work to expand their empires without leaving the block.

“Our neighbors laugh and say ‘what were you trying to do—play Monopoly?’,” said Alexa Hampton, a 44-year-old interior designer who, with her husband, successfully purchased two apartments adjacent to their unit to create a roughly 3,500-square-foot spread.

The convenience of buying the property next door doesn’t come cheap. Purchasers can expect to pay at least 10% above the market rate—and sometimes much more, real-estate agents said. Premiums are especially high in hot property markets like New York City and Los Angeles, where space is hard to come by.

In December, actress and writer Tina Fey paid $9.51 million—roughly $2 million over the asking price—for the apartment above hers on New York’s Upper West Side. Last year, film producer Megan Ellison, daughter of software billionaire Larry Ellison, plunked down $5.25 million for the house next to her $30 million estate in the Hollywood Hills. And in 2014 nighttime talk show host Jimmy Fallon bought a fifth apartment in his New York City building, where he bought his first unit in 2002.

The chase can take years. Mr. Solomon, a 31-year-old agent at Douglas Elliman Real Estate, and his husband longed to buy their neighbors’ unit, which shared their view of Long Island City’s Pepsi-Cola sign. But the neighbors, a couple with a small child, rebuffed Mr. Solomon’s offer to buy it.

Then, about a year later, the neighbors turned the tables, offering to buy Mr. Solomon’s apartment. He countered, and eventually bought the neighbor’s apartment for $915,000, a price he thinks is about $15,000 over market value. After combining the units, he lives in a 1,900-square-foot apartment with two bedrooms, 2½ bathrooms, a den and a laundry room. Best of all, he said, “every room has the same view.”

Jeff Thomas also had to be patient. In 2012 Mr. Thomas, a real-estate developer and owner of car dealerships, bought a 4,000-square-foot house with views in Los Angeles’s Hollywood Hills for $4.25 million with real-estate agent Paul Blair of the Agency. Mr. Thomas wanted to expand, but found that local laws wouldn’t let him unless he had more land.

About six months after he moved in, the house next door came on the market. Mr. Thomas put in an offer, but the property sold to a higher bidder for $2.25 million. About two years later, Mr. Thomas approached the owners through a friend and asked them to name their price, then quickly agreed to their ask of $2.7 million.

Throughout, Mr. Thomas, 50, kept his identity as their neighbor hidden. “If they feel they have a captive buyer, who really wants or really needs this property, it’s just human nature to try to get as much as they can out of this guy,” he said. He now plans to demolish both homes and build a 17,350-square-foot house with four bedrooms plus staff quarters, an infinity pool and a roof deck with views. The new home would likely be worth $20 million to $30 million, according to Mr. Blair.

Sometimes convincing neighbors to sell requires finding them a new home. “People get very creative for a little extra square footage,” said real-estate agent Nada Rizk of Brown Harris Stevens.

Royce Pinkwater, founder of the real-estate investment brokerage company Pinkwater Select, described one Manhattan combination she orchestrated last spring as “the most complicated deal I’ve ever done in my career.” For clients who wanted to expand their three-bedroom Upper West Side apartment, she hired an investigator to find the contact information for the owners of the two-bedroom apartment directly below theirs. To convince the neighbors, an elderly couple, to sell, she had to find them another apartment in the building and offer them $6.5 million, about 20% over market, for their unit. Then after the closing, her clients had to wait months for the couple to renovate their new apartment before moving out.

After all that, Ms. Pinkwater’s clients changed their minds, and both units are now on the market for a total of $19.25 million.

Ms. Cornell-McKenna, 49, founder of the lifestyle brand Young Fabulous & Broke, purchased her Hollywood Hills house, with a view of Century City and the ocean, in 2007. Almost right away she started fantasizing about buying the house next door, with which she shared a driveway, for her mother. “I had a vision of a compound,” said Ms. Cornell-McKenna, who at the time was a single mother. About five years ago, she started saving money to purchase the house, creating an LLC called “1423 Devlin Drive,” after the property’s address.

Then her neighbor—a woman in her 90s who Ms. Cornell-McKenna had befriended—looked into getting a reverse mortgage on the home to help pay her expenses, but couldn’t get one. In 2012, with advice from Douglas Elliman agent Tracy Tutor Maltas, Ms. Cornell-McKenna signed an agreement to buy the house for $2 million, with the understanding that the deal wouldn’t close until the owner died. Meanwhile, Ms. Cornell-McKenna would pay the neighbor $8,000 a month. The payments would be subtracted from the home’s price, and when the neighbor died, Ms. Cornell-McKenna would have 60 days to close.

The arrangement was “a risk,” Ms. Cornell-McKenna said, because she wasn’t sure how long the neighbor would live or if she’d have enough money saved when it came time to close. It ended up working out: The neighbor lived for two years before dying at age 100, during which time “my company did better and better,” Ms. Cornell-McKenna said. She closed on the home in February of 2015.

Real-estate agents caution that bigger isn’t always better. Before making plans to combine two properties, buyers should make sure the combination won’t create an awkward layout, which can hurt the home’s value, said Ms. Pinkwater. “There are combinations that happen that should never have happened,” she said. “It has to make sense.”

If it works, a combination can provide better value, especially in markets where real-estate values have appreciated rapidly. When Stacy Rauen, 37, editor of Hospitality Design magazine and founder of the prenatal beverage Bump Water, found out she was pregnant with twins in the spring of 2014, she was living in a two-bedroom apartment in Williamsburg, Brooklyn, with her husband and their toddler son. With one new baby, “we could have made it work,” she said. “But not with two of them.”

They started looking around for larger apartments and were disappointed with the options. “To get a three or four-bedroom, we were kind of priced out of what we wanted,” she said.

The apartment upstairs seemed like the solution—it was on the market and had the same layout as theirs for an easy combination. But by the time the Rauens found out about the twins, it had gone into contract. So they made an offer on a three-bedroom in another building, which was accepted.

Then the unit upstairs fell out of contract. Ms. Rauen’s husband knocked on the upstairs neighbor’s door one Sunday night and offered to buy the apartment for just under the asking price. The neighbors agreed, and the Rauens retracted their offer on the other apartment. They paid $1.645 million for the unit plus a parking spot and private rooftop patio.

After the closing, the Rauens spent about $200,000 to combine the spaces into a four-bedroom duplex with a playroom and a “mini-mudroom” with space for two strollers. They finished the week before Ms. Rauen gave birth.

Combining the two apartments made getting a mortgage a little more complicated than they expected, she said, which delayed the closing by a few weeks. Another quirk of the setup is that they have two separate electric and cable bills.

But because they’d purchased their original apartment in 2011 for $749,000, even with the renovation the total cost was still less than the other apartment they’d made an offer on, which had less living space and fewer amenities.

Plus, she added, “We were able to make something that fit exactly how we wanted to live.”