The song was inspired by the classic blue-eyed soul sounds of Hall & Oates. "It was summer," Puth recalled to Billboard
. "I was just about to go on tour with my buddy Shawn Mendes, and I put on Hall & Oates…and I was like, 'Okay, I wanna make a record like that.'"
Puth added that called up one of his A&R pals and said, "Wouldn't it be cool, like if there was a song called 'How Long Has This Been Going On?' and each kick drum would be on the lyric?"
"I had one broken Rokit speaker to produce this record on," he continued. "Every night after I would get off stage, I'd just kind of build the track out even more and I still wanted it to be like, thematically with a bass. My bass player Dmitry came in and he had this sick preamp and he plugged it in and it sounded bouncy … like me walking with a big cup of coffee down the street. Like Fat Albert or Mickey Mouse when he drops the piano."