Harry, 24, was expecting to stay with Ben Winston and his family in north London for two weeks while he was waiting to get his mansion on nearby Hampstead Heath ready but he was with them for 20 months.
He brought home a string of girls, including singer Taylor Swift, to share his humble bachelor room – with only a double mattress on the floor.
Ben, 36, one of Harry’s closest friends behind 1D’s early music videos, is writing the show for the CBS network.
He told how he and his wife Meredith would stay up at night to see who their guest brought to their home in Hampstead in north London.
Their young daughter Ruby was also star struck.
“It was exciting seeing the array of A-Listers that would come and sleep in the attic,” he said.
“That was what we enjoyed because we’d be in bed like an old couple.
“We’d have our spot cream on our faces and we’d be in our pyjamas.
“The stairwell was right outside our door, so we’d wait to see if Harry came home alone or with company.”
A spokesman for CBS said: “The pilot we have commissioned is about an early-30s, happily married couple with a young daughter whose lives are upended when a [then] 20-year-old pop star comes to live with them.”
During his stay, the lead character breaks up with his “demanding, high-profile girlfriend” – a possible reference to Harry’s turbulent on-off relationship with Taylor Swift.
Ben also works with James Corden, 39, who hosts The Late Late Show in the US and helped Harry prepare to be a guest.
He added: “For that whole period, [Harry] was living with us in the most mundane suburban situation.
“He made our house a home and, when he finally moved out, we were gutted.”