CHICAGO - Jimmy Butler bet on himself and won big.

Butler agreed to terms Wednesday on a five-year maximum contract that could be worth $90 million and includes a player option for the final year, a person with knowledge of the situation told The Associated Press on condition of anonymity because the deal has not been finalized. The total value of the contract could wind up being a little higher depending on the salary cap figure for next season, which will be set on July 9.

The deal comes on the heels of a breakout season in which Butler made his first All-Star team and was selected the NBA's Most Improved Player. He averaged 20 points after he and the Bulls were unable to agree to a contract extension last fall.

The Bulls also agreed to terms with Mike Dunleavy on a three-year, $14 million deal, according to a person with knowledge of the negotiations. The person also spoke on condition of anonymity because no contracts can be signed until July 9.

Butler posted a photo of downtown Chicago on his Twitter account with the words, "windy city skyline ... aka home."

It's been a remarkable rise for Butler, who was kicked out of his house by his mother at age 13, started his college career at Tyler Junior College and was the last pick in the first round out of Marquette in 2011. He quickly became indispensable for the Bulls and his tireless work ethic endeared him to hard-nosed coach Tom Thibodeau.

Thibodeau is gone now, replaced by Fred Hoiberg. But Butler and Derrick Rose will be back in what should be a dynamic backcourt for the Bulls.

Butler turned down a four-year, $44 million offer from the Bulls before last season. At the time he said he was betting on himself, willing to play last year for just under $3.2 million to earn the right to become a restricted free agent.

It turned out to be a wise decision. Butler solidified himself as perhaps the best two-way shooting guard in the league, averaging career highs in points (20.0), rebounds (5.8), field goal percentage (46.2), 3-point percentage (37.8) and minutes (38.7).

The breakout season earned Butler almost $50 million more with his new contract than the one he would have signed last year. And even though he entered restricted free agency and garnered interest from the Lakers and other teams, Butler made it clear all along where his heart was.

"I think this is a place for me," Butler said after he was given the Most Improved Player award. "I love playing with the guys we have. They continue to bring in great, high-character guys that fit the team role. I love it here."

Dunleavy is back as well, meaning most of the key players return from the team that took the Cleveland Cavaliers to six games in the Eastern Conference semifinals.

Dunleavy was expected to get interest from several other clubs, including Cleveland.

He turns 35 in September, and averaged 9.4 points in 63 games and shot 41 per cent from 3-point range last season. In the playoffs, he averaged 10.9 points and shot 48 per cent from beyond the arc. The No. 3 pick in the 2002 draft has averaged 11.7 points in 902 career games.

___

AP Basketball Writer Tim Reynolds contributed to this report. Krawczynski contributed from Minneapolis.