The Finland Under-19 international originally moved to Loftus Road in 2014 and made his first-team debut for the club during their EFL Cup clash with Sunderland in September.
The youngster, who has gone on to feature sporadically for the R's in the Championship, has now signed a new contract which runs until the summer of 2019.
Hamalainen is now looking to become a first-team regular over the coming months.
"It's great that QPR sees a future in me," Hamalainen told the club website. "Hopefully I can keep performing as I have been and just get better and better. Over the next two years I really want to become a regular in the squad and push hard to become the starting left-back."
Ian Holloway has taken charge at Loftus Road since Hamalainen forced his way into the first-team picture and the full-back has been impressed with the new boss since his return to W12.
He added: "They want the best out of everyone. They want us to work hard, never give up and wear the QPR badge with honour - that's what I will be looking to do."