All Bryan Ye needed to be more productive were a few more hours in his busy day. But the 22-year-old college student and aspiring novelist was spending too much time on social media, and usually didn’t fall asleep until long after midnight.

“It was pure chaos,” Ye told NBC News BETTER. “I would do anything I wanted. I would bring my laptop to bed. I’d watch different movies. I’d call friends and talk to them for a really long time.”

Ye, a part-time user experience writer for a software company in Sydney, Australia, is studying economics and computer science at the University of New South Wales, and blogs regularly about productivity on Medium.com. He knew that to write more, he’d have to get up earlier before work.

On most mornings, Ye would wake up at 8:00 a.m. when his alarm clock began to wail. He’d scramble to get ready for work, exhausted after only six hours of sleep.

In the last five months, Ye has completely transformed his nighttime habits. He’s going to bed earlier, getting up at 5 a.m. every morning, and writing about 1,000 words before going to work.

Back in June, Ye slowly developed a new set of habits that would help him become an early riser. He turned to a practice his favorite novelist Haruki Murakami called “mesmerizing” in a 2004 interview with the Paris Review — gradually accustoming oneself to a new habit until it becomes so routine that you do it without thinking about it, like brushing your teeth before bed, Ye says.

“That’what mesmerism is,” says Ye. “A habit forming you.”

Here’s how Ye used mesmerism to get up at 5 a.m. every morning, get more sleep, and get more done.

He gradually built a new night time routine

Ye slowly dialed back his bedtime to 9 p.m. At first, he started going to bed at 10 p.m. Once he got used to falling asleep at 10, he dialed the time back to 9:30. When he was able to fall asleep at 9:30, he started to go to bed at 9.

“I’d sometimes stay in bed for like 30 minutes or an hour, but eventually I’d fall asleep, and then eventually my body just learned that,” Ye says.

He created a boring sleep environment

Ye made a rule to no longer bring his phone into his bedroom, and eliminated anything from the room that would distract him.

“I make it so there is pretty much no stimuli to distract me,” says Ye. “I’ve gotten rid of books, phones, and pretty much everything else from that room. There is nothing on the wall to look at. And the purpose of that is so when I go into that room, I know that it’s for sleep only.”

He set up a routine to start winding down before bed

Ye, who works 9-5, only has a small window of time between when he comes home from work and when he goes to bed. He leaves work at 5, get off the train at 6, spends an hour at the gym, and gets home at around 7. After he eats dinner, he begins the process of winding down for bed.

He has a rule not to do any work before bed, recalling, “I always went to sleep with anxiety when I did that.” Instead, he watches an episode of a sitcom, which he says takes his mind off of his responsibilities.

“It really helps,” he says, “because it puts me in a good mood to sleep.”

He prepares for his work day the night before

Before Ye goes to bed, he picks out what clothes he’s going to wear the next day, which he says saves him time in the morning before work so he can focus more on his writing.

“All I have to do is brush my teeth, and put it on, and then I can leave,” he says.

After about two weeks of following his new night time routine, Ye started to fall asleep regularly at 9 p.m.

He created a morning routine

Once Ye started getting to bed earlier, he began to work on developing a morning routine. In the beginning, he decided not to force himself to get up early, allowing himself to sleep for as long as he wanted. Once he got into the routine of falling asleep a 9, getting up at 5 a.m. started to happen naturally, he says.

He got a sunrise alarm

Ye bought a “sunrise” alarm clock, which wakes him up with a flashing light instead of an audible alarm. Unlike traditional alarm clocks, Ye says the sunrise alarm mimics the sun rising, waking him up gradually so he feels less tired.

“You feel like you’re waking up naturally,” Ye says.

But Ye says he usually wakes up on his own around 5 a.m. He sets the sunrise alarm for 5:30, and only needs it as a backup if he oversleeps.

He takes a day off

Ye says he allows himself to stay in bed late one morning a week on Saturdays.

“I don’t believe in limiting yourself to the point where your life is all about productivity and there’s like all these limitations to your life,” says Ye. “I feel like I wouldn’t be able to live like that, and I would be happy to let myself off the hook once a week.”

He slowly introduced work into his mornings

Ye didn’t force himself to write when he began getting up at 5 a.m., because he knew it would be a difficult transition. Instead, he allowed himself to do whatever he wanted, like browsing social media and watching videos online. After a few days, he started to introduce writing into his mornings.

Following advice from “The Artist's Way: A Spiritual Path To Higher Creativity,” a popular self-help book by Julia Cameron, Ye began to keep a journal on his nightstand next to his bed. As soon as he wakes up, he writes three longhand pages to get himself into the flow of writing.

“I turn on the lights, I grab my journal, and I just start writing,” he says.

“And when you practice that, day after day, it sort of tricks your mind that you don’t need a perfect environment in order to write, you can just write,” he says.

Ye says he now writes between 20 to 30 blog articles a month. He hopes to write his first novel using the same method of penning 1,000 words every morning before work.

“It’s becoming apparent to me that if I write at the pace I am now — like a thousand words a day — I can probably write the first draft of a novel in like three months,” he says.

Increased productivity isn’t the only advantage to Ye’s new sleep routine — he estimates that he sleeps about two hours longer than he used to.

“I definitely have a lot more energy during the day,” he says.

“I’m definitely happier because of it,” adds Ye. “I don’t know if I’m happier because I’m getting more done or because I’m doing something I love. I enjoy writing, and this way I get to write more, which makes me happier.”

MORE FROM BETTER

Want more tips like these? NBC News BETTER is all about finding easier, healthier and smarter ways to live. Sign up for our newsletter and follow us on Facebook, Twitter and Instagram.