In 2000, Riley enter politics and ran for a seat on the Hillsboro City Council, losing to incumbent Karen McKinney. The following year he ran for a seat in the Oregon House of Representatives as a Democrat to represent District 29, running unopposed in the primary election. In the November general election he lost to Republican Mary Gallegos by a total of 434 votes. In May 2004, Riley defeated Elena Uhing in the Democratic primary for the same district. Riley then defeated Gallegos in the November 2004 election for the same seat. In 2006, he faced off against Terry Rilling in the district that has more Democratic voters than Republicans. Riley won with 55% of the vote to Rilling's 45% in the November election. In the 2007-08 Legislature, Riley was chairman of the Government Accountability and Information Technology Committee in the House. During the 2008 special session he also served on the Consumer Protection and the Workforce and Economic Development committees. Riley faced Rilling again in the November 2008 election for the House seat after Republican primary winner Jeff Duyck was later declared ineligible. Duyck's property spans two districts and the county elections office miscalculated where he was registered to vote and thus which seat he was eligible to run for. Politically, Riley supported Measure 50 in 2007 and Measure 49 in 2007, and is pro-choice on the issue of abortion. In 2009, he announced he would run for a seat in the Oregon State Senate in 2010, challenging incumbent Republican Bruce Starr in District 15. Riley lost to Starr, and in 2011 ran for a seat on the school board for Portland Community College, losing in May to Deanna Palm. In 2014, Riley ran again for Senate against Starr. The contest was one of the most expensive legislative races in the state and was decided by the closest vote margin, with Riley edging out Starr by just a few hundred votes. He was sworn into the Senate on January 12, 2015, and serves on the Senate Committee on Business and Transportation, the Senate Committee on Finance and Revenue, the Joint Committee on Tax Credits, and the Joint Committee on Audits. Additionally, he serves as co-chair of the Ways and Means Subcommittee on Information Technology. In April 2015, gun rights activists filed a recall petition against Riley. The recall was initiated over Riley's support for "mandatory vaccinations, repealing the gain share tax, increasing the minimum wage, background checks for private gun sales and voting to under-fund the state education system." The recall effort was dropped when organizers could not collect sufficient signatures to place the recall question on the ballot. On Jan 9, 2017 Riley sponsored SB115 in the senate. This bill would have banned the sale of leaded aviation fuel in Oregon, starting in 2020. The bill did not come out of committee.